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:
J. Ryan Stinnett 2019-04-23 14:55:57 +01:00
parent 008ca3543b
commit 4f41161a47
5 changed files with 77 additions and 26 deletions

View file

@ -87,12 +87,12 @@ export default class Field extends React.PureComponent {
this.input.focus();
}
validate({ focused, allowEmpty = true }) {
async validate({ focused, allowEmpty = true }) {
if (!this.props.onValidate) {
return;
}
const value = this.input ? this.input.value : null;
const { valid, feedback } = this.props.onValidate({
const { valid, feedback } = await this.props.onValidate({
value,
focused,
allowEmpty,