From e6ec164fe9ef45a8171e5743afae45a5c190e4f8 Mon Sep 17 00:00:00 2001 From: FinnStutzenstein Date: Tue, 12 Mar 2019 12:01:00 +0100 Subject: [PATCH] Fixed redirection on login subpages (fixed #4474) --- .../core/core-services/openslides.service.ts | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/client/src/app/core/core-services/openslides.service.ts b/client/src/app/core/core-services/openslides.service.ts index b4bf63643..4626fcd50 100644 --- a/client/src/app/core/core-services/openslides.service.ts +++ b/client/src/app/core/core-services/openslides.service.ts @@ -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) ||