Reputation: 1375
I'm using PasswordStrengthBar import PasswordStrengthBar from 'react-password-strength-bar';
https://www.npmjs.com/package/react-password-strength-bar
I want to display a message when the confirmation button is clicked and the password is weak .. How should I check if the password is weak or good?
<input type="password" className="form-control" value={this.state.newPassword} onChange={this.passwordOnChange} id="pwd" />
<PasswordStrengthBar password={this.state.newPassword} />
Upvotes: 0
Views: 436
Reputation: 4848
According to github source of this package
https://github.com/lannex/react-password-strength-bar/blob/master/examples/src/Home.js
you can call a function whenever score changes with onChangeScore
attribute
<PasswordStrengthBar
password={this.state.newPassword}
onChangeScore={score => {
console.log(score);
}}
/>
Upvotes: 3