fix: set minimum passcode length

This commit is contained in:
Antonella Sgarlatta
2021-07-01 16:44:10 -03:00
parent 2295f5d593
commit 1d4eae5d00
2 changed files with 13 additions and 2 deletions

View File

@@ -18,6 +18,7 @@ import {
STRING_CONFIRM_APP_QUIT_DURING_PASSCODE_REMOVAL,
STRING_UNSUPPORTED_BACKUP_FILE_VERSION,
StringUtils,
Strings,
} from '@/strings';
import { PasswordWizardType } from '@/types';
import {
@@ -509,8 +510,17 @@ class AccountMenuCtrl extends PureViewCtrl<unknown, AccountMenuState> {
}
async submitPasscodeForm() {
const passcode = this.getState().formData.passcode!;
if (passcode !== this.getState().formData.confirmPasscode!) {
const passcode = this.getState().formData.passcode;
if (!passcode || passcode.length === 0) {
await alertDialog({
text: Strings.enterPasscode,
});
this.passcodeInput[0].focus();
return;
}
if (passcode !== this.getState().formData.confirmPasscode) {
await alertDialog({
text: STRING_NON_MATCHING_PASSCODES,
});

View File

@@ -113,6 +113,7 @@ export const Strings = {
openAccountMenu: 'Open Account Menu',
trashNotesTitle: 'Move to Trash',
trashNotesText: 'Are you sure you want to move these notes to the trash?',
enterPasscode: 'Please enter a passcode.',
};
export const StringUtils = {