Skip to content

Commit

Permalink
Add keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
ginnyTheCat committed Sep 8, 2022
1 parent 8ed3632 commit 0233600
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/app/templates/auth/Auth.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ const CONFIRM_PASSWORD_ERROR = 'Passwords don\'t match.';
const EMAIL_REGEX = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i;
const BAD_EMAIL_ERROR = 'Invalid email address';

const MATRIX_KEYWORDS = ['matrix', 'cinny', 'element', 'synapse', 'dendrite'];

function isValidInput(value, regex) {
if (typeof regex === 'string') return regex === value;
return regex.test(value);
Expand Down Expand Up @@ -317,7 +319,7 @@ function Register({ registerInfo, loginFlow, baseUrl }) {
errors.username = BAD_LOCALPART_ERROR;
}
if (values.password.length > 0) {
const result = zxcvbn(values.password);
const result = zxcvbn(values.password, [...MATRIX_KEYWORDS, values.username, values.email]);
if (result.feedback) {
errors.password = result.feedback.warning;
}
Expand Down

0 comments on commit 0233600

Please sign in to comment.