Skip to content

Commit

Permalink
fix: add hyphen to password regexes
Browse files Browse the repository at this point in the history
  • Loading branch information
rupl committed Sep 28, 2021
1 parent 98034aa commit 1c3d8b6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion api/models/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ UserSchema.statics = {
*/
isStrongPassword(password) {
// eslint-disable-next-line no-useless-escape
const regex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()+=\\`{}[\]:";'< >?,.\/]).+$/;
const regex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()+=\\`{}[\]:";'< >?,.\/-]).+$/;
return password.length >= 12 && regex.test(password);
},

Expand Down
2 changes: 1 addition & 1 deletion assets/js/passwords.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
function checkPassword(password) {
// eslint-disable-next-line no-useless-escape
var passwordStrength = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()+=\\`{}[\]:";'< >?,.\/]).+$/;
var passwordStrength = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()+=\\`{}[\]:";'< >?,.\/-]).+$/;
return password.length >= 12 && passwordStrength.test(password);
}

Expand Down
2 changes: 1 addition & 1 deletion templates/includes/password-regex.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&amp;*()+=\\`{}[\]:&quot;;'&lt; &gt;?,.\/]).+$
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&amp;*()+=\\`{}[\]:&quot;;'&lt; &gt;?,.\/-]).+$
2 changes: 1 addition & 1 deletion templates/includes/password-requirements.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<li>One number <code>0123456789</code></li>
<li>One uppercase character <code>ABCDEFGHIJKLMNOPQRSTUVWXYZ</code></li>
<li>One lowercase character <code>abcdefghijklmnopqrstuvwxyz</code></li>
<li>One special character <code>!@#$%^&amp;*()+=\`{}[]:";'&lt; &gt;?,./</code></li>
<li>One special character <code>!@#$%^&amp;*()+=\`{}[]:";'&lt; &gt;?,./-</code></li>
</ul>
</li>
<li>Not be based on a simple word or pattern.</li>
Expand Down

0 comments on commit 1c3d8b6

Please # to comment.