177.2. Fixing denied access to user management console for unauthenticated users by Guard (#25)

This commit is contained in:
Art
2021-09-21 23:05:51 +03:00
parent f8ce75d285
commit 36cc9a22c4
2 changed files with 3 additions and 2 deletions

View File

@ -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'}
];

View File

@ -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;
}