Fixed redirection on login subpages (fixed #4474)

This commit is contained in:
FinnStutzenstein 2019-03-12 12:01:00 +01:00
parent b30340b72f
commit e6ec164fe9
1 changed files with 13 additions and 13 deletions

View File

@ -66,18 +66,7 @@ export class OpenSlidesService {
const response = await this.operator.whoAmIFromStorage();
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']);
}
this.redirectToLoginIfNotSubpage();
this.checkOperator(false);
} else {
await this.afterLoginBootup(response.user_id);
@ -88,6 +77,17 @@ export class OpenSlidesService {
}
}
/**
* Redirects the user to /login, if he isn't on a subpage.
*/
private redirectToLoginIfNotSubpage(): void {
if (!this.redirectUrl.includes('/login/')) {
// Goto login, if the user isn't on a subpage like
// legal notice or reset passwort view.
this.router.navigate(['/login']);
}
}
/**
* the login bootup-sequence: Check (and maybe clear) the cache und setup the DataStore
* and websocket. This "login" also may be the "login" of an anonymous when he is using
@ -152,7 +152,7 @@ export class OpenSlidesService {
// User logged off.
if (!response.user && !response.guest_enabled) {
await this.shutdown();
this.router.navigate(['/login']);
this.redirectToLoginIfNotSubpage();
} else {
if (
(this.operator.user && this.operator.user.id !== response.user_id) ||