0

我正在使用PasswordStrengthBar import PasswordStrengthBar from 'react-password-strength-bar'; https://www.npmjs.com/package/react-password-strength-bar

我想在单击确认按钮并且密码很弱时显示一条消息.. 我应该如何检查密码是弱密码还是好密码?

<input type="password" className="form-control" value={this.state.newPassword} onChange={this.passwordOnChange} id="pwd" />
<PasswordStrengthBar   password={this.state.newPassword}   />
4

1 回答 1

3

根据这个包的github来源

https://github.com/lannex/react-password-strength-bar/blob/master/examples/src/Home.js

每当分数随onChangeScore属性变化时,您都可以调用函数

 <PasswordStrengthBar
        password={this.state.newPassword}
        onChangeScore={score => {
          console.log(score);
        }}
      />
于 2021-06-20T09:24:35.157 回答