177.2. Fixing denied access to user management console for unauthenticated users by Guard (#25)
This commit is contained in:
@ -3,11 +3,12 @@ import {RouterModule, Routes} from "@angular/router";
|
||||
import {LoginComponent} from "./component/login/login.component";
|
||||
import {RegisterComponent} from "./component/register/register.component";
|
||||
import {UserComponent} from "./component/user/user.component";
|
||||
import {AuthenticationGuard} from "./guard/authentication.guard";
|
||||
|
||||
export const routes: Routes = [
|
||||
{path: 'login', component: LoginComponent},
|
||||
{path: 'register', component: RegisterComponent},
|
||||
{path: 'user/management', component: UserComponent},
|
||||
{path: 'user/management', component: UserComponent, canActivate: [AuthenticationGuard]},
|
||||
{path: '', redirectTo: '/login', pathMatch: 'full'}
|
||||
];
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ export class AuthenticationGuard implements CanActivate {
|
||||
else {
|
||||
this.router.navigate(['/login']);
|
||||
|
||||
this.notificationService.notify(NotificationType.ERROR, `You need to log in to access this page`.toUpperCase());
|
||||
this.notificationService.notify(NotificationType.ERROR, `You need to log in to access this page`);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user