]>
Commit | Line | Data |
---|---|---|
d12b40fb C |
1 | <h1> |
2 | <my-global-icon iconName="cog" aria-hidden="true"></my-global-icon> | |
3 | <ng-container i18n>Two factor authentication</ng-container> | |
4 | </h1> | |
5 | ||
6 | <div i18n *ngIf="twoFactorAlreadyEnabled === true" class="root already-enabled"> | |
7 | Two factor authentication is already enabled. | |
8 | </div> | |
9 | ||
10 | <div class="root" *ngIf="twoFactorAlreadyEnabled === false"> | |
11 | <ng-container *ngIf="step === 'request'"> | |
12 | <form role="form" (ngSubmit)="requestTwoFactor()" [formGroup]="formPassword"> | |
13 | ||
14 | <label i18n for="current-password">Your password</label> | |
15 | <div class="form-group-description" i18n>Confirm your password to enable two factor authentication</div> | |
16 | ||
17 | <my-input-text | |
18 | formControlName="current-password" inputId="current-password" i18n-placeholder placeholder="Current password" | |
19 | [formError]="formErrorsPassword['current-password']" autocomplete="current-password" | |
20 | ></my-input-text> | |
21 | ||
22 | <input class="peertube-button orange-button mt-3" type="submit" i18n-value value="Confirm" [disabled]="!formPassword.valid"> | |
23 | </form> | |
24 | </ng-container> | |
25 | ||
26 | <ng-container *ngIf="step === 'confirm'"> | |
27 | ||
28 | <p i18n> | |
29 | Scan this QR code into a TOTP app on your phone. This app will generate tokens that you will have to enter when logging in. | |
30 | </p> | |
31 | ||
32 | <qrcode [qrdata]="twoFactorURI" [width]="256" level="Q"></qrcode> | |
33 | ||
34 | <div i18n> | |
35 | If you can't scan the QR code and need to enter it manually, here is the plain-text secret: | |
36 | </div> | |
37 | ||
38 | <div class="secret-plain-text">{{ twoFactorSecret }}</div> | |
39 | ||
40 | <form class="mt-3" role="form" (ngSubmit)="confirmTwoFactor()" [formGroup]="formOTP"> | |
41 | ||
42 | <label i18n for="otp-token">Two-factor code</label> | |
43 | <div class="form-group-description" i18n>Enter the code generated by your authenticator app to confirm</div> | |
44 | ||
45 | <my-input-text | |
46 | [show]="true" formControlName="otp-token" inputId="otp-token" | |
47 | [formError]="formErrorsOTP['otp-token']" autocomplete="otp-token" | |
48 | ></my-input-text> | |
49 | ||
50 | <input class="peertube-button orange-button mt-3" type="submit" i18n-value value="Confirm" [disabled]="!formOTP.valid"> | |
51 | </form> | |
52 | </ng-container> | |
53 | ||
54 | </div> |