Add switching between key input and passphrase input.
This commit is contained in:
parent
f95841cc06
commit
a9fcf35a54
@ -19,7 +19,9 @@
|
||||
<mat-label>Private Key</mat-label>
|
||||
<textarea matInput style="height: 30rem" name="privateKeyAsc" id="privateKeyAsc" formControlName="key"
|
||||
placeholder="Enter your private key..." [errorStateMatcher]="matcher"></textarea>
|
||||
<mat-error *ngIf="keyFormStub.key.errors.required">Private Key is required.</mat-error>
|
||||
<div *ngIf="submitted && keyFormStub.key.errors" class="invalid-feedback">
|
||||
<mat-error *ngIf="keyFormStub.key.errors.required">Private Key is required.</mat-error>
|
||||
</div>
|
||||
</mat-form-field>
|
||||
|
||||
<button mat-raised-button matRipple color="primary" type="submit" [disabled]="loading">
|
||||
@ -41,7 +43,9 @@
|
||||
<mat-label>Passphrase</mat-label>
|
||||
<input matInput name="state" id="state" formControlName="passphrase"
|
||||
placeholder="Enter your passphrase..." [errorStateMatcher]="matcher">
|
||||
<mat-error *ngIf="passphraseFormStub.passphrase.errors.required">Passphrase is required.</mat-error>
|
||||
<div *ngIf="submitted && passphraseFormStub.passphrase.errors" class="invalid-feedback">
|
||||
<mat-error *ngIf="passphraseFormStub.passphrase.errors.required">Passphrase is required.</mat-error>
|
||||
</div>
|
||||
</mat-form-field>
|
||||
|
||||
<button mat-raised-button matRipple color="primary" type="submit" [disabled]="loading">
|
||||
|
@ -22,7 +22,7 @@ export class AddKeyComponent implements OnInit, AfterViewInit {
|
||||
) { }
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
console.debug(window.location);
|
||||
console.log(window.location);
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.responseType = 'text';
|
||||
xhr.open('GET', window.location.origin + '/privatekey.asc');
|
||||
@ -55,10 +55,27 @@ export class AddKeyComponent implements OnInit, AfterViewInit {
|
||||
|
||||
this.loading = true;
|
||||
this.authService.setKey(this.keyFormStub.key.value).then();
|
||||
this.switchWindows();
|
||||
}
|
||||
|
||||
login(): void {
|
||||
if (this.passphraseForm.invalid) { return; }
|
||||
this.authService.login();
|
||||
}
|
||||
|
||||
switchWindows(): void {
|
||||
const divOne = document.getElementById('one');
|
||||
const divTwo = document.getElementById('two');
|
||||
this.toggleDisplay(divOne);
|
||||
this.toggleDisplay(divTwo);
|
||||
}
|
||||
|
||||
toggleDisplay(element: any): void {
|
||||
const style = window.getComputedStyle(element).display;
|
||||
if (style === 'block') {
|
||||
element.style.display = 'none';
|
||||
} else {
|
||||
element.style.display = 'block';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -86,7 +86,7 @@
|
||||
|
||||
<div class="row mt-3">
|
||||
<div class="col-12 text-center">
|
||||
<p class="text-muted">Already have account? <a routerLink="/auth" class="text-muted ml-1"><b>Log In</b></a></p>
|
||||
<p class="text-muted">Already have account? <a routerLink="/auth/key" class="text-muted ml-1"><b>Log In</b></a></p>
|
||||
</div> <!-- end col-->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
|
Loading…
Reference in New Issue
Block a user