]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Fix redirect after changing password 35196/head
authorTiago Melo <tmelo@suse.com>
Fri, 22 May 2020 10:58:39 +0000 (10:58 +0000)
committerTiago Melo <tmelo@suse.com>
Fri, 22 May 2020 10:58:39 +0000 (10:58 +0000)
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>
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 3e98b5268b43b72eccfe5d2244664f81e01df479..e4ef9753c7eefa3fe3e04e9d0eb783c9fdafee96 100644 (file)
@@ -300,8 +300,7 @@ const routes: Routes = [
         path: 'login-change-password',
         component: LoginPasswordFormComponent,
         canActivate: [NoSsoGuardService]
-      },
-      { path: 'logout', children: [] }
+      }
     ]
   },
   {
index a53f4451cb3bf28416269fac4ea3774ca566c79b..44e9201381b5d32059e387c562bb8e8b2a79d197 100644 (file)
@@ -79,6 +79,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 b88e8d853206a66f7a0d9064a32c28fac7f0f232..986907d53dcbd0bcd1ee2cb2aad5eb2ec44a228c 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();