Merge pull request #592 from standardnotes/bugfix/set-minimum-passcode-length

fix: set minimum passcode length
This commit is contained in:
Antonella Sgarlatta
2021-07-01 16:57:13 -03:00
committed by GitHub
2 changed files with 13 additions and 2 deletions

View File

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

View File

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