Commit e71cfa7e authored by dev0tion's avatar dev0tion

Add functionality to login component

parent ebd028f3
<h1>Welcome back</h1>
<p>Please enter your password to decrypt your wallet</p>
<form (ngSubmit)="onSubmit()" #passwordForm="ngForm">
<div *ngIf="hasWallet">
<p>Choose the wallet you want to open:</p>
<div class="form-group">
<label for="password">Your password: </label>
<input type="password" class="form-control" id="password" required name="password">
<label for="walletLabel">Wallet to open:</label>
<select name="wallet" #walletName>
<option *ngFor="let wallet of wallets">{{wallet}}</option>
</select>
</div>
<button type="submit" class="btn btn-success">Decrypt</button>
</form>
\ No newline at end of file
<p>Please enter your password to decrypt your wallet</p>
<form (ngSubmit)="onSubmit()" #passwordForm="ngForm">
<div class="form-group">
<label for="password">Your password: </label>
<input type="password" class="form-control" id="password" required name="password">
</div>
<button type="submit" class="btn btn-success">Decrypt</button>
</form>
<p></p>
</div>
<p> If you like to create or restore a wallet please click the button below.</p>
<button type="button" (click)="clickedCreate()" class="btn btn-success">Create or restore wallet</button>
\ No newline at end of file
......@@ -10,26 +10,53 @@ import { WalletLoad } from '../shared/wallet-load';
})
export class LoginComponent implements OnInit {
constructor(private apiService: ApiService, private router: Router) { }
private walletLoad: WalletLoad;
private hasWallet: boolean = false;
private wallets: [any];
private walletPath: string;
private responseMessage: any;
private errorMessage: any;
private walletLoad: WalletLoad;
ngOnInit() {
this.apiService.getWalletFiles()
.subscribe(
response => {
if (response.status >= 200 && response.status < 400) {
this.responseMessage=response;
this.wallets = response.json().walletsFiles;
this.walletPath = response.json().walletsPath;
console.log(this.wallets);
if (this.wallets.length > 0) {
this.hasWallet = true;
}
}
},
error => {
this.errorMessage = <any>error;
if (error.status >= 400) {
alert(this.errorMessage);
console.log(this.errorMessage);
}
}
);
}
private onSubmit() {
this.walletLoad = new WalletLoad();
this.walletLoad.password = "123";
this.walletLoad.name = "test"
this.walletLoad.folderPath = "folderPath"
this.walletLoad.password = "test";
this.walletLoad.name = "myFirstWallet"
this.walletLoad.folderPath = "/home/dev0tion/Desktop/Wallets"
this.apiService.loadWallet(this.walletLoad)
.subscribe(
response => {
console.log(response);
if (response.status >= 200 && response.status < 400) {
this.responseMessage = response;
this.router.navigate['/wallet']
this.router.navigate(['/wallet']);
}
},
error => {
......@@ -41,4 +68,8 @@ export class LoginComponent implements OnInit {
}
);
}
private clickedCreate() {
this.router.navigate(['/setup']);
}
}
\ No newline at end of file
<h1>Welcome to Breeze. Looks like you're new here.</h1>
<h1>Welcome to Breeze.</h1>
<p>
If you haven't used Breeze before, please create a new wallet.
</p>
......
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