Merge pull request #4251 from tsiegleauq/login-redirect-issues

Allow reload on login children
This commit is contained in:
Emanuel Schütze 2019-02-04 15:30:52 +01:00 committed by GitHub
commit a6043ba8d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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; this.operator.guestsEnabled = response.guest_enabled;
if (!response.user && !response.guest_enabled) { if (!response.user && !response.guest_enabled) {
this.redirectUrl = location.pathname; this.redirectUrl = location.pathname;
// Goto login, if the user isn't login and guests are not allowed
this.router.navigate(['/login']); // 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 { } else {
await this.afterLoginBootup(response.user_id); await this.afterLoginBootup(response.user_id);
} }

View File

@ -58,21 +58,23 @@ export class ResetPasswordConfirmComponent extends BaseComponent implements OnIn
public ngOnInit(): void { public ngOnInit(): void {
super.setTitle('Reset password'); super.setTitle('Reset password');
this.activatedRoute.queryParams.subscribe(params => { this.activatedRoute.queryParams.subscribe(params => {
if (!params.user_id || !params.token) { if (!this.user_id && !this.token) {
setTimeout(() => { if (!params.user_id || !params.token) {
this.matSnackBar.open(''); setTimeout(() => {
this.matSnackBar.open( this.matSnackBar.open('');
this.translate.instant('The link is broken. Please contact your system administrator.'), this.matSnackBar.open(
this.translate.instant('OK'), this.translate.instant('The link is broken. Please contact your system administrator.'),
{ this.translate.instant('OK'),
duration: 0 {
} duration: 0
); }
this.router.navigate(['/']); );
}); this.router.navigate(['/login']);
} else { });
this.user_id = params.user_id; } else {
this.token = params.token; this.user_id = params.user_id;
this.token = params.token;
}
} }
}); });
} }