From 50d448167293554cd8a1192e078f872147f35373 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Tue, 29 Jun 2021 11:21:03 +1000 Subject: [PATCH] fix symbols allowed for password + update tests --- ts/test/session/unit/utils/{Password.ts => Password_test.ts} | 1 + ts/util/passwordUtils.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) rename ts/test/session/unit/utils/{Password.ts => Password_test.ts} (99%) diff --git a/ts/test/session/unit/utils/Password.ts b/ts/test/session/unit/utils/Password_test.ts similarity index 99% rename from ts/test/session/unit/utils/Password.ts rename to ts/test/session/unit/utils/Password_test.ts index a5cca5a39..b1747b0d2 100644 --- a/ts/test/session/unit/utils/Password.ts +++ b/ts/test/session/unit/utils/Password_test.ts @@ -40,6 +40,7 @@ describe('Password Util', () => { 'TiJf@lk^jsO^z8MUn%)[Sd~UPQ)ci9CGS@jb<^', '$u&%{r]apg#G@3dQdCkB_p8)gxhNFr=K&yfM_M8O&2Z.vQyvx', 'bf^OMnYku*iX;{Piw_0zvz', + '@@@@/???\\4545', '#'.repeat(50), ]; valid.forEach(pass => { diff --git a/ts/util/passwordUtils.ts b/ts/util/passwordUtils.ts index d5f5d6f30..d6c12d1e0 100644 --- a/ts/util/passwordUtils.ts +++ b/ts/util/passwordUtils.ts @@ -33,7 +33,7 @@ export const validatePassword = (phrase: string) => { } // Restrict characters to letters, numbers and symbols - const characterRegex = /^[a-zA-Z0-9-!()._`~@#$%^&*+=[\]{}|<>,;: ]+$/; + const characterRegex = /^[a-zA-Z0-9-!?/\\()._`~@#$%^&*+=[\]{}|<>,;: ]+$/; if (!characterRegex.test(trimmed)) { return window?.i18n ? window?.i18n('passwordCharacterError') : ERRORS.CHARACTER; }