Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 1a103ba
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/app/main/action/login-form/login-form.component.ts
Expand Up @@ -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(['/'])
);
Expand Down

0 comments on commit 1a103ba

Please sign in to comment.