Check password complexity during registration
This adds a password complexity rule during registration to require strong passwords. This is based on the `zxcvbn` module that we already use for key backup passphrases. In addition, this also tweaks validation more generally to allow rules to be async functions.
This commit is contained in:
parent
008ca3543b
commit
4f41161a47
5 changed files with 77 additions and 26 deletions
|
@ -67,7 +67,9 @@ export function scorePassword(password) {
|
|||
if (password.length === 0) return null;
|
||||
|
||||
const userInputs = ZXCVBN_USER_INPUTS.slice();
|
||||
userInputs.push(MatrixClientPeg.get().getUserIdLocalpart());
|
||||
if (MatrixClientPeg.get()) {
|
||||
userInputs.push(MatrixClientPeg.get().getUserIdLocalpart());
|
||||
}
|
||||
|
||||
let zxcvbnResult = zxcvbn(password, userInputs);
|
||||
// Work around https://github.com/dropbox/zxcvbn/issues/216
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue