]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Fix redirect after changing password 35243/head
authorTiago Melo <tmelo@suse.com>
Fri, 22 May 2020 10:58:39 +0000 (10:58 +0000)
committerNathan Cutler <ncutler@suse.com>
Tue, 26 May 2020 12:14:22 +0000 (14:14 +0200)
After the changes made to subscriptions, redirecting to the dummy logout page
no longer does anything.

So we removed the logout route and now redirect directly to the login page.

Fixes: https://tracker.ceph.com/issues/45651
Signed-off-by: Tiago Melo <tmelo@suse.com>
(cherry picked from commit 54ecfa90129989239aa66ab087cb1a8afe607735)

src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts
src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-password-form/user-password-form.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-password-form/user-password-form.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/auth.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/auth.service.ts

index 3a4646ac4bb29eb6ad1909b6ec30cc7a054c9761..f046d9c115a3f9fc8af7ecb45aad0d3cf867e207 100644 (file)
@@ -298,8 +298,7 @@ const routes: Routes = [
         path: 'login-change-password',
         component: LoginPasswordFormComponent,
         canActivate: [NoSsoGuardService]
-      },
-      { path: 'logout', children: [] }
+      }
     ]
   },
   {
index 3ac5f040fb0944f66d14cfac580409a0ae25b550..31a7d7f971c72193be5e7534c9a019dd56f75e64 100644 (file)
@@ -82,6 +82,6 @@ describe('UserPasswordFormComponent', () => {
     });
     request.flush({});
     expect(component.onPasswordChange).toHaveBeenCalled();
-    expect(router.navigate).toHaveBeenCalledWith(['/logout']);
+    expect(router.navigate).toHaveBeenCalledWith(['/login']);
   });
 });
index e77d9d86bf6fdf2d395196aba3c9fb6853da55bb..cf08a134fb33f6fb3fbe3405afaee41a6106a924 100644 (file)
@@ -116,10 +116,6 @@ export class UserPasswordFormComponent {
    */
   onPasswordChange() {
     this.notificationService.show(NotificationType.success, this.i18n('Updated user password"'));
-    // Theoretically it is not necessary to navigate to '/logout' because
-    // the auth token gets invalid after changing the password in the
-    // backend, thus the user would be automatically logged out after the
-    // next periodically API request is executed.
-    this.router.navigate(['/logout']);
+    this.router.navigate(['/login']);
   }
 }
index 6a2e63d7b41926b5efb8a21a5b21732105654209..1dffaf04a77b81de9fd6e8df5933294ef3ea0348 100644 (file)
@@ -11,7 +11,7 @@ describe('AuthService', () => {
   let service: AuthService;
   let httpTesting: HttpTestingController;
 
-  const routes: Routes = [{ path: 'logout', children: [] }];
+  const routes: Routes = [{ path: 'login', children: [] }];
 
   configureTestBed({
     providers: [AuthService, AuthStorageService],
index c6229377f90654525b2121115c888b9b5fb8a247..c8ac216f78b91ce36af631296c201df6cdfbe44d 100644 (file)
@@ -41,7 +41,7 @@ export class AuthService {
 
   logout(callback: Function = null) {
     return this.http.post('api/auth/logout', null).subscribe((resp: any) => {
-      this.router.navigate(['/logout'], { skipLocationChange: true });
+      this.router.navigate(['/login'], { skipLocationChange: true });
       this.authStorageService.remove();
       if (callback) {
         callback();