Skip to content

Commit

Permalink
Merge pull request #1108 from ORCID/add-guard-on-login-page
Browse files Browse the repository at this point in the history
add guard to login page
  • Loading branch information
bobcaprice authored Feb 7, 2024
2 parents f22f759 + b0234b7 commit 488f37b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions ui/src/app/account/account.route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ export const routes: Routes = [
{
path: 'login',
component: LoginComponent,
data: {
authorities: [],
pageTitle: 'global.menu.account.login.string',
},
canActivate: [AuthGuard],
},
{
path: 'reset/request',
Expand Down
6 changes: 5 additions & 1 deletion ui/src/app/account/auth.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ export const AuthGuard = (route: ActivatedRouteSnapshot, state: RouterStateSnaps
if (hasAnyAuthority) {
return true
} else {
router.navigate(['accessdenied'])
if (state.url === '/login') {
router.navigate(['/'])
} else {
router.navigate(['accessdenied'])
}
return false
}
} else {
Expand Down

0 comments on commit 488f37b

Please sign in to comment.