Skip to content

Commit

Permalink
fix: set minimum passcode length
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonella Sgarlatta committed Jul 1, 2021
1 parent 2295f5d commit 1d4eae5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
14 changes: 12 additions & 2 deletions app/assets/javascripts/directives/views/accountMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
});
Expand Down
1 change: 1 addition & 0 deletions app/assets/javascripts/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit 1d4eae5

Please sign in to comment.