Skip to content
Permalink
Browse files
refactor(login-form): don't redirect user if they are a member of onl…
…y one project AND they are a sysAdmin (#782)
  • Loading branch information
mdelez committed Jul 28, 2022
1 parent 064a7dc commit 1a103ba8273ada9e913c7a1a541d446b9c74121a
Showing 1 changed file with 3 additions and 3 deletions.
@@ -167,12 +167,12 @@ export class LoginFormComponent implements OnInit, AfterViewInit {
const username = this.session.user.name;
this._dspApiConnection.admin.usersEndpoint.getUserByUsername(username).subscribe(
(userResponse: ApiResponseData<UserResponse>) => {
// if user is only a member of one project, redirect them to that projects dashboard
if(userResponse.body.user.projects.length === 1) {
// if user is NOT a sysAdmin and only a member of one project, redirect them to that projects dashboard
if(!this.session.user.sysAdmin && userResponse.body.user.projects.length === 1) {
this._router.navigateByUrl('/refresh', { skipLocationChange: true }).then(
() => this._router.navigate(['/beta/project/' + userResponse.body.user.projects[0].shortcode])
);
} else { // if user is a member of multiple projects, redirect them to the overview
} else { // if user is a sysAdmin or a member of multiple projects, redirect them to the overview
this._router.navigateByUrl('/refresh', { skipLocationChange: true }).then(
() => this._router.navigate(['/'])
);

0 comments on commit 1a103ba

Please sign in to comment.