docs: Change Password Blur from password to confirm (#5076)

* Change Password Blur from password to confirm

If you type check password, then type password, the validation won't be changed

* rename variables and functions name

rename handlePasswordBlur to handleConfirmBlur
rename passwordDirty to confirmDirty
This commit is contained in:
Eden Wang 2017-02-28 11:30:04 +08:00 committed by Wei Zhu
parent d0f31f39a3
commit 445c940af4

View File

@ -44,7 +44,7 @@ const residences = [{
class RegistrationForm extends React.Component {
state = {
passwordDirty: false,
confirmDirty: false,
};
handleSubmit = (e) => {
e.preventDefault();
@ -54,9 +54,9 @@ class RegistrationForm extends React.Component {
}
});
}
handlePasswordBlur = (e) => {
handleConfirmBlur = (e) => {
const value = e.target.value;
this.setState({ passwordDirty: this.state.passwordDirty || !!value });
this.setState({ confirmDirty: this.state.confirmDirty || !!value });
}
checkPassword = (rule, value, callback) => {
const form = this.props.form;
@ -68,7 +68,7 @@ class RegistrationForm extends React.Component {
}
checkConfirm = (rule, value, callback) => {
const form = this.props.form;
if (value && this.state.passwordDirty) {
if (value && this.state.confirmDirty) {
form.validateFields(['confirm'], { force: true });
}
callback();
@ -121,7 +121,7 @@ class RegistrationForm extends React.Component {
validator: this.checkConfirm,
}],
})(
<Input type="password" onBlur={this.handlePasswordBlur} />
<Input type="password" />
)}
</FormItem>
<FormItem
@ -136,7 +136,7 @@ class RegistrationForm extends React.Component {
validator: this.checkPassword,
}],
})(
<Input type="password" />
<Input type="password" onBlur={this.handleConfirmBlur} />
)}
</FormItem>
<FormItem