From 06bfa314cb5989f3956497c13b609df6f76757bd Mon Sep 17 00:00:00 2001 From: Sean Engelhardt Date: Mon, 4 Feb 2019 15:17:03 +0100 Subject: [PATCH] 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. --- .../core/core-services/openslides.service.ts | 13 ++++++-- .../reset-password-confirm.component.ts | 32 ++++++++++--------- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/client/src/app/core/core-services/openslides.service.ts b/client/src/app/core/core-services/openslides.service.ts index d370f41c4..615d5df37 100644 --- a/client/src/app/core/core-services/openslides.service.ts +++ b/client/src/app/core/core-services/openslides.service.ts @@ -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; - // 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 { await this.afterLoginBootup(response.user_id); } diff --git a/client/src/app/site/login/components/reset-password-confirm/reset-password-confirm.component.ts b/client/src/app/site/login/components/reset-password-confirm/reset-password-confirm.component.ts index 784f3d046..bb21644ed 100644 --- a/client/src/app/site/login/components/reset-password-confirm/reset-password-confirm.component.ts +++ b/client/src/app/site/login/components/reset-password-confirm/reset-password-confirm.component.ts @@ -58,21 +58,23 @@ export class ResetPasswordConfirmComponent extends BaseComponent implements OnIn public ngOnInit(): void { super.setTitle('Reset password'); this.activatedRoute.queryParams.subscribe(params => { - if (!params.user_id || !params.token) { - setTimeout(() => { - this.matSnackBar.open(''); - this.matSnackBar.open( - this.translate.instant('The link is broken. Please contact your system administrator.'), - this.translate.instant('OK'), - { - duration: 0 - } - ); - this.router.navigate(['/']); - }); - } else { - this.user_id = params.user_id; - this.token = params.token; + if (!this.user_id && !this.token) { + if (!params.user_id || !params.token) { + setTimeout(() => { + this.matSnackBar.open(''); + this.matSnackBar.open( + this.translate.instant('The link is broken. Please contact your system administrator.'), + this.translate.instant('OK'), + { + duration: 0 + } + ); + this.router.navigate(['/login']); + }); + } else { + this.user_id = params.user_id; + this.token = params.token; + } } }); }