Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(login-form): don't redirect sysAdmin after login (DEV-1153) #782

Merged
merged 1 commit into from Jul 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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