From 1a103ba8273ada9e913c7a1a541d446b9c74121a Mon Sep 17 00:00:00 2001 From: mdelez <60604010+mdelez@users.noreply.github.com> Date: Thu, 28 Jul 2022 13:50:02 +0200 Subject: [PATCH] refactor(login-form): don't redirect user if they are a member of only one project AND they are a sysAdmin (#782) --- src/app/main/action/login-form/login-form.component.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/main/action/login-form/login-form.component.ts b/src/app/main/action/login-form/login-form.component.ts index 07f2538300..a691402150 100644 --- a/src/app/main/action/login-form/login-form.component.ts +++ b/src/app/main/action/login-form/login-form.component.ts @@ -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) => { - // 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(['/']) );