feat: reword storage upgrade migration

This commit is contained in:
Baptiste Grob
2020-07-10 12:40:20 +02:00
parent 6602d35573
commit a81e2f02e5
3 changed files with 56 additions and 14 deletions

View File

@@ -3,11 +3,7 @@
.sn-component
.sk-panel
.sk-panel-header
.sk-panel-header-title Authentication Required
a.close-button.info(
ng-if="ctrl.cancelable"
ng-click="ctrl.cancel()"
) Cancel
.sk-panel-header-title {{ctrl.title}}
.sk-panel-content
.sk-panel-section
div(ng-repeat="type in ctrl.state.types")
@@ -33,6 +29,11 @@
ng-disabled="ctrl.state.processing"
)
.sk-label {{ctrl.state.processing ? 'Generating Keys...' : 'Submit'}}
.sk-panel-row(ng-if="ctrl.cancelable")
a.sk-panel-row.sk-a.info.centered(
ng-if="ctrl.cancelable"
ng-click="ctrl.cancel()"
) Cancel
.sk-panel-footer(ng-if="ctrl.state.showForgotPasscodeLink")
a.sk-panel-row.sk-a.info.centered(

View File

@@ -10,7 +10,14 @@ import {
import { PureViewCtrl } from '@Views/abstract/pure_view_ctrl';
import { WebDirective } from '@/types';
import { confirmDialog } from '@/services/alertService';
import { STRING_SIGN_OUT_CONFIRMATION } from '@/strings';
import {
STRING_SIGN_OUT_CONFIRMATION,
STRING_ENTER_ACCOUNT_PASSCODE,
STRING_ENTER_ACCOUNT_PASSWORD,
STRING_ENTER_PASSCODE_FOR_MIGRATION,
STRING_STORAGE_UPDATE,
STRING_AUTHENTICATION_REQUIRED
} from '@/strings';
type InputValue = {
value: string
@@ -57,7 +64,25 @@ class ChallengeModalCtrl extends PureViewCtrl {
invalid: false
};
}
const showForgotPasscodeLink = this.challenge.reason === ChallengeReason.ApplicationUnlock
let showForgotPasscodeLink: boolean;
switch (this.challenge.reason) {
case ChallengeReason.ApplicationUnlock:
showForgotPasscodeLink = true;
this.cancelable = false;
break;
case ChallengeReason.Migration:
showForgotPasscodeLink = true;
this.cancelable = false;
break;
case ChallengeReason.ProtocolUpgrade:
showForgotPasscodeLink = false;
this.cancelable = true;
break;
case ChallengeReason.ResaveRootKey:
showForgotPasscodeLink = false;
this.cancelable = true;
break;
}
this.cancelable = !showForgotPasscodeLink
this.setState({
types,
@@ -97,11 +122,22 @@ class ChallengeModalCtrl extends PureViewCtrl {
});
}
promptForChallenge(challenge: ChallengeType) {
if (challenge === ChallengeType.LocalPasscode) {
return 'Enter your application passcode';
get title(): string {
if (this.challenge.reason === ChallengeReason.Migration) {
return STRING_STORAGE_UPDATE;
} else {
return 'Enter your account password';
return STRING_AUTHENTICATION_REQUIRED;
}
}
promptForChallenge(challenge: ChallengeType): string {
if (challenge === ChallengeType.LocalPasscode) {
if (this.challenge.reason === ChallengeReason.Migration) {
return STRING_ENTER_PASSCODE_FOR_MIGRATION;
}
return STRING_ENTER_ACCOUNT_PASSCODE;
} else {
return STRING_ENTER_ACCOUNT_PASSWORD;
}
}
@@ -116,10 +152,10 @@ class ChallengeModalCtrl extends PureViewCtrl {
}
cancel() {
if (!this.cancelable) {
return;
if (this.cancelable) {
this.application!.cancelChallenge(this.challenge);
this.dismiss();
}
this.dismiss();
}
onForgotPasscodeClick() {