Commit f36ed56e authored by dev0tion's avatar dev0tion

Add temporary password check

parent cb88292e
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<form (ngSubmit)="onSubmit()" #passwordForm="ngForm"> <form (ngSubmit)="onSubmit()" #passwordForm="ngForm">
<div class="form-group"> <div class="form-group">
<label for="password">Your password: </label> <label for="password">Your password: </label>
<input type="password" class="form-control" id="password" required name="password"> <input type="password" class="form-control" id="password" [(ngModel)]="password" required name="password">
</div> </div>
<button type="submit" class="btn btn-success">Decrypt</button> <button type="submit" class="btn btn-success">Decrypt</button>
</form> </form>
......
...@@ -16,13 +16,13 @@ export class LoginComponent implements OnInit { ...@@ -16,13 +16,13 @@ export class LoginComponent implements OnInit {
private currentWalletName: string; private currentWalletName: string;
private wallets: [any]; private wallets: [any];
private walletPath: string; private walletPath: string;
private password: string;
private responseMessage: any; private responseMessage: any;
private errorMessage: any; private errorMessage: any;
ngOnInit() { ngOnInit() {
this.currentWalletName = "";
this.apiService.getWalletFiles() this.apiService.getWalletFiles()
.subscribe( .subscribe(
response => { response => {
...@@ -51,7 +51,7 @@ export class LoginComponent implements OnInit { ...@@ -51,7 +51,7 @@ export class LoginComponent implements OnInit {
private onSubmit() { private onSubmit() {
this.walletLoad = new WalletLoad(); this.walletLoad = new WalletLoad();
this.walletLoad.password = "test"; this.walletLoad.password = this.password;
this.walletLoad.name = this.currentWalletName; this.walletLoad.name = this.currentWalletName;
this.walletLoad.folderPath = this.walletPath; this.walletLoad.folderPath = this.walletPath;
...@@ -68,7 +68,9 @@ export class LoginComponent implements OnInit { ...@@ -68,7 +68,9 @@ export class LoginComponent implements OnInit {
}, },
error => { error => {
this.errorMessage = <any>error; this.errorMessage = <any>error;
if (error.status >= 400) { if (error.status === 403 && error.json().errors[0].message === "Wrong password, please try again.") {
alert("Wrong password, try again.");
} else if (error.status >= 400) {
alert(this.errorMessage); alert(this.errorMessage);
console.log(this.errorMessage); console.log(this.errorMessage);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment