mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-11 12:03:03 +00:00
[#2624][DURACOM-204] Created new guard for forgot route
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, NoPreloading } from '@angular/router';
|
||||
import { NoPreloading, RouterModule } from '@angular/router';
|
||||
import { AuthBlockingGuard } from './core/auth/auth-blocking.guard';
|
||||
|
||||
import { AuthenticatedGuard } from './core/auth/authenticated.guard';
|
||||
@@ -40,6 +40,7 @@ import {
|
||||
import { ServerCheckGuard } from './core/server-check/server-check.guard';
|
||||
import { MenuResolver } from './menu.resolver';
|
||||
import { ThemedPageErrorComponent } from './page-error/themed-page-error.component';
|
||||
import { ForgotPasswordCheckGuard } from './core/rest-property/forgot-password-check-guard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@@ -94,7 +95,10 @@ import { ThemedPageErrorComponent } from './page-error/themed-page-error.compone
|
||||
path: FORGOT_PASSWORD_PATH,
|
||||
loadChildren: () => import('./forgot-password/forgot-password.module')
|
||||
.then((m) => m.ForgotPasswordModule),
|
||||
canActivate: [EndUserAgreementCurrentUserGuard]
|
||||
canActivate: [
|
||||
ForgotPasswordCheckGuard,
|
||||
EndUserAgreementCurrentUserGuard
|
||||
]
|
||||
},
|
||||
{
|
||||
path: COMMUNITY_MODULE_PATH,
|
||||
|
@@ -0,0 +1,31 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, Router, RouterStateSnapshot } from '@angular/router';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { AuthorizationDataService } from '../data/feature-authorization/authorization-data.service';
|
||||
import { FeatureID } from '../data/feature-authorization/feature-id';
|
||||
import {
|
||||
SingleFeatureAuthorizationGuard
|
||||
} from '../data/feature-authorization/feature-authorization-guard/single-feature-authorization.guard';
|
||||
import { AuthService } from '../auth/auth.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
/**
|
||||
* Guard that checks if the forgot-password feature is enabled
|
||||
*/
|
||||
export class ForgotPasswordCheckGuard extends SingleFeatureAuthorizationGuard {
|
||||
|
||||
constructor(
|
||||
protected readonly authorizationService: AuthorizationDataService,
|
||||
protected readonly router: Router,
|
||||
protected readonly authService: AuthService
|
||||
) {
|
||||
super(authorizationService, router, authService);
|
||||
}
|
||||
|
||||
getFeatureID(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<FeatureID> {
|
||||
return of(FeatureID.EPersonForgotPassword);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user