Update verify master password component (#553)
This commit is contained in:
parent
e1b1efeea2
commit
ea9a8b979d
|
@ -5,14 +5,20 @@
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container *ngIf="usesKeyConnector">
|
<ng-container *ngIf="usesKeyConnector">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<button type="button" class="btn btn-primary" (click)="requestOTP()" [disabled]="disableRequestOTP">
|
<label class="d-block">{{'sendVerificationCode' | i18n}}</label>
|
||||||
{{'requestVerificationCode' | i18n}}
|
<button type="button" class="btn btn-outline-secondary" (click)="requestOTP()" [disabled]="disableRequestOTP">
|
||||||
|
{{'sendCode' | i18n}}
|
||||||
</button>
|
</button>
|
||||||
|
<span class="ml-2 text-success" role="alert" @sent *ngIf="sentCode">
|
||||||
|
<i class="fa fa-check-circle-o" aria-hidden="true"></i>
|
||||||
|
{{'codeSent' | i18n}}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="verificationCode">{{'verificationCode' | i18n}}</label>
|
<label for="verificationCode">{{'verificationCode' | i18n}}</label>
|
||||||
<input id="verificationCode" type="input" name="verificationCode" class="form-control"
|
<input id="verificationCode" type="input" name="verificationCode" class="form-control"
|
||||||
[formControl]="secret" required appAutofocus appInputVerbatim>
|
[formControl]="secret" required appAutofocus appInputVerbatim>
|
||||||
|
<small class="form-text text-muted">{{'confirmIdentity' | i18n}}</small>
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
import {
|
||||||
|
animate,
|
||||||
|
style,
|
||||||
|
transition,
|
||||||
|
trigger,
|
||||||
|
} from '@angular/animations';
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
OnInit,
|
OnInit,
|
||||||
|
@ -25,10 +31,19 @@ import { Verification } from 'jslib-common/types/verification';
|
||||||
useExisting: VerifyMasterPasswordComponent,
|
useExisting: VerifyMasterPasswordComponent,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
animations: [
|
||||||
|
trigger('sent', [
|
||||||
|
transition(':enter', [
|
||||||
|
style({ opacity: 0 }),
|
||||||
|
animate('100ms', style({ opacity: 1 })),
|
||||||
|
]),
|
||||||
|
]),
|
||||||
|
],
|
||||||
})
|
})
|
||||||
export class VerifyMasterPasswordComponent implements ControlValueAccessor, OnInit {
|
export class VerifyMasterPasswordComponent implements ControlValueAccessor, OnInit {
|
||||||
usesKeyConnector: boolean = false;
|
usesKeyConnector: boolean = false;
|
||||||
disableRequestOTP: boolean = false;
|
disableRequestOTP: boolean = false;
|
||||||
|
sentCode: boolean = false;
|
||||||
|
|
||||||
secret = new FormControl('');
|
secret = new FormControl('');
|
||||||
|
|
||||||
|
@ -47,7 +62,12 @@ export class VerifyMasterPasswordComponent implements ControlValueAccessor, OnIn
|
||||||
async requestOTP() {
|
async requestOTP() {
|
||||||
if (this.usesKeyConnector) {
|
if (this.usesKeyConnector) {
|
||||||
this.disableRequestOTP = true;
|
this.disableRequestOTP = true;
|
||||||
await this.userVerificationService.requestOTP();
|
try {
|
||||||
|
await this.userVerificationService.requestOTP();
|
||||||
|
this.sentCode = true;
|
||||||
|
} finally {
|
||||||
|
this.disableRequestOTP = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue