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