From eeff25b18aec905f8b85e4cd546ab72d18af0044 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Tue, 9 Feb 2021 12:16:13 +0000 Subject: [PATCH] [Trunk | Explore]: orcid-routing.module & orcid.module: Add LoginGuard (not FreeGuard) before loading /orcid route (user must be logged in to get tokens). git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@60387 d315682c-612b-4755-9ff5-7f18f6832af3 --- explore/src/app/orcid/orcid-routing.module.ts | 7 +++++-- explore/src/app/orcid/orcid.module.ts | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/explore/src/app/orcid/orcid-routing.module.ts b/explore/src/app/orcid/orcid-routing.module.ts index 3768510b..79c020bf 100644 --- a/explore/src/app/orcid/orcid-routing.module.ts +++ b/explore/src/app/orcid/orcid-routing.module.ts @@ -2,13 +2,16 @@ import { NgModule } from '@angular/core'; import { RouterModule } from '@angular/router'; import {OpenaireOrcidComponent} from './orcid.component'; -import {FreeGuard} from "../openaireLibrary/login/freeGuard.guard"; import {PreviousRouteRecorder} from "../openaireLibrary/utils/piwik/previousRouteRecorder.guard"; +import {LoginGuard} from "../openaireLibrary/login/loginGuard.guard"; @NgModule({ imports: [ RouterModule.forChild([ - { path: '', component: OpenaireOrcidComponent, canActivate: [FreeGuard], + { path: '', component: OpenaireOrcidComponent, + canActivate: [LoginGuard], data: { + redirect: '/error', community : 'openaire' + }, canDeactivate: [PreviousRouteRecorder] } ]) diff --git a/explore/src/app/orcid/orcid.module.ts b/explore/src/app/orcid/orcid.module.ts index 04c36917..fb566187 100644 --- a/explore/src/app/orcid/orcid.module.ts +++ b/explore/src/app/orcid/orcid.module.ts @@ -6,6 +6,7 @@ import {OrcidRoutingModule} from './orcid-routing.module'; import {PreviousRouteRecorder} from "../openaireLibrary/utils/piwik/previousRouteRecorder.guard"; import {FormsModule} from "@angular/forms"; import {OrcidModule} from "../openaireLibrary/orcid/orcid.module"; +import {LoginGuard} from "../openaireLibrary/login/loginGuard.guard"; @NgModule({ imports: [ @@ -15,7 +16,7 @@ import {OrcidModule} from "../openaireLibrary/orcid/orcid.module"; declarations: [ OpenaireOrcidComponent ], - providers: [PreviousRouteRecorder], + providers: [PreviousRouteRecorder, LoginGuard], exports: [ OpenaireOrcidComponent ]