Allow reload on login children

Fixes a bug where the user was always redirected to
/login/ as unknown user, when they tried to
load children from login page from an external references.
This commit is contained in:
Sean Engelhardt 2019-02-04 15:17:03 +01:00
parent 27ecb6f411
commit 06bfa314cb
2 changed files with 28 additions and 17 deletions

View File

@ -58,8 +58,17 @@ export class OpenSlidesService extends OpenSlidesComponent {
this.operator.guestsEnabled = response.guest_enabled;
if (!response.user && !response.guest_enabled) {
this.redirectUrl = location.pathname;
// let the use navigate and reload on every login-page
if (this.redirectUrl.includes('/login/')) {
// Allow free navigation in the children of the login page
// required for resetting password and direct navigation to legal notice
// and privacy policy.
this.router.navigate([this.redirectUrl]);
} else {
// Goto login, if the user isn't login and guests are not allowed
this.router.navigate(['/login']);
}
} else {
await this.afterLoginBootup(response.user_id);
}

View File

@ -58,6 +58,7 @@ export class ResetPasswordConfirmComponent extends BaseComponent implements OnIn
public ngOnInit(): void {
super.setTitle('Reset password');
this.activatedRoute.queryParams.subscribe(params => {
if (!this.user_id && !this.token) {
if (!params.user_id || !params.token) {
setTimeout(() => {
this.matSnackBar.open('');
@ -68,12 +69,13 @@ export class ResetPasswordConfirmComponent extends BaseComponent implements OnIn
duration: 0
}
);
this.router.navigate(['/']);
this.router.navigate(['/login']);
});
} else {
this.user_id = params.user_id;
this.token = params.token;
}
}
});
}