Commit 9185afae authored by Cédric Moreau's avatar Cédric Moreau

[enh] Connection par trousseau : mémorisation possible à la connexion

parent 824f7300
......@@ -45,6 +45,10 @@
<div class="upload">
<input id="custom-input" type="file" (change)="fileChangeListener($event)">
<label for="custom-input" ion-button>Charger le fichier trousseau...</label>
<ion-item>
<ion-checkbox color="royal" [(ngModel)]="remember" checked="false"></ion-checkbox>
<ion-label>Mémoriser ce trousseau le temps de la session de navigation</ion-label>
</ion-item>
</div>
<p class="help">
......
......@@ -17,6 +17,7 @@ export class ConnectPage implements OnInit {
pub:string
salt:string
passwd:string
remember:Boolean
constructor(
private router: Router,
......@@ -59,8 +60,13 @@ export class ConnectPage implements OnInit {
}
fileChangeListener($event) {
this.cryptoService.loadFromFile($event, false)
this.cryptoService.loadFromFile($event, this.remember)
.then(pair => {
if (this.remember) {
sessionStorage.setItem('publicKey', base58.encode(pair.publicKey))
sessionStorage.setItem('secretKey', base58.encode(pair.secretKey))
sessionStorage.setItem('remember', "1")
}
this.loginService.identify(base58.encode(pair.publicKey))
this.router.navigate([`/mon_compte`])
})
......
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