]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/blob
0e72cca35a8dfc39a863fd61b4d5b1598662db61
[ceph.git] /
1 import { Component } from '@angular/core';
2 import { Router } from '@angular/router';
3
4 import { AuthService } from '~/app/shared/api/auth.service';
5 import { UserService } from '~/app/shared/api/user.service';
6 import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
7 import { CdFormBuilder } from '~/app/shared/forms/cd-form-builder';
8 import { AuthStorageService } from '~/app/shared/services/auth-storage.service';
9 import { NotificationService } from '~/app/shared/services/notification.service';
10 import { PasswordPolicyService } from '~/app/shared/services/password-policy.service';
11 import { UserPasswordFormComponent } from '../user-password-form/user-password-form.component';
12
13 @Component({
14   selector: 'cd-login-password-form',
15   templateUrl: './login-password-form.component.html',
16   styleUrls: ['./login-password-form.component.scss']
17 })
18 export class LoginPasswordFormComponent extends UserPasswordFormComponent {
19   constructor(
20     public actionLabels: ActionLabelsI18n,
21     public notificationService: NotificationService,
22     public userService: UserService,
23     public authStorageService: AuthStorageService,
24     public formBuilder: CdFormBuilder,
25     public router: Router,
26     public passwordPolicyService: PasswordPolicyService,
27     public authService: AuthService
28   ) {
29     super(
30       actionLabels,
31       notificationService,
32       userService,
33       authStorageService,
34       formBuilder,
35       router,
36       passwordPolicyService
37     );
38   }
39
40   onPasswordChange() {
41     // Logout here because changing the password will change the
42     // session token which will finally lead to a 401 when calling
43     // the REST API the next time. The API HTTP interceptor will
44     // then also redirect to the login page immediately.
45     this.authService.logout();
46   }
47
48   onCancel() {
49     this.authService.logout();
50   }
51 }