Skip to content
Snippets Groups Projects
Commit 86cf367c authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

Merge branch 'bugfix/login_and_registration' into 'develop'

bugfix/login and registration

See merge request !28
parents 7ac46d77 3d51ea67
No related branches found
No related tags found
2 merge requests!29Add page from Cesium v1, add management of peer,!28bugfix/login and registration
Pipeline #39952 waiting for manual action
......@@ -81,41 +81,43 @@ export class AuthModal implements OnInit, AuthModalOptions {
// Disable the form
this.form.disable();
if (data.v2.mnemonic.includes('//')) {
const account = await this.accountService.addAccount(data);
return this.modalCtrl.dismiss(account, <AuthModalRole>'VALIDATE');
}
if (this.loginMethod === 'v2') {
if (data.v2.mnemonic.includes('//')) {
const account = await this.accountService.addAccount(data);
return this.modalCtrl.dismiss(account, <AuthModalRole>'VALIDATE');
}
// Scan for derivations
const derivations = await this.accountService.scanDerivations(data.v2.mnemonic);
// Scan for derivations
const derivations = await this.accountService.scanDerivations(data.v2.mnemonic);
// Only one derivation: use it
let selectedDerivationAccount: DerivationAccount;
if (derivations?.length === 1) {
selectedDerivationAccount = derivations[0];
}
// Only one derivation: use it
let selectedDerivationAccount: DerivationAccount;
if (derivations?.length === 1) {
selectedDerivationAccount = derivations[0];
}
// Many derivation: let the user choose
else if (derivations?.length > 1) {
const modal = await this.modalCtrl.create({
component: DerivationSelectionComponent,
componentProps: {
mnemonic: data.v2.mnemonic,
derivations,
},
});
await modal.present();
const res = await modal.onDidDismiss();
if (AccountUtils.isDerivationAccount(res?.data)) {
selectedDerivationAccount = res.data;
// Many derivation: let the user choose
else if (derivations?.length > 1) {
const modal = await this.modalCtrl.create({
component: DerivationSelectionComponent,
componentProps: {
mnemonic: data.v2.mnemonic,
derivations,
},
});
await modal.present();
const res = await modal.onDidDismiss();
if (AccountUtils.isDerivationAccount(res?.data)) {
selectedDerivationAccount = res.data;
}
}
}
// Update mnemonic, to use the derivation
if (selectedDerivationAccount) {
console.info(`[auth] Will use derivation: ${selectedDerivationAccount?.derivation}`);
data.v2.mnemonic += selectedDerivationAccount?.derivation;
// Update mnemonic, to use the derivation
if (selectedDerivationAccount) {
console.info(`[auth] Will use derivation: ${selectedDerivationAccount?.derivation}`);
data.v2.mnemonic += selectedDerivationAccount?.derivation;
}
}
const account = await this.accountService.addAccount(data);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment