|
|
|
@ -152,7 +152,30 @@ class AccountSecure extends Component {
|
|
|
|
|
onPasswordSubmit = () => {
|
|
|
|
|
this.props.form.validateFieldsAndScroll((err, values) => {
|
|
|
|
|
if (!err) {
|
|
|
|
|
|
|
|
|
|
if(values.p_old == values.p_new){
|
|
|
|
|
this.props.showNotification("新密码不能与旧密码相同!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(values.p_again != values.p_new){
|
|
|
|
|
this.props.showNotification("两次输入的新密码必须一致!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
let {login}=this.props.current_user;
|
|
|
|
|
let url=`/users/accounts/${login}/password.json`;
|
|
|
|
|
axios.put((url),{
|
|
|
|
|
old_password:values.p_old,
|
|
|
|
|
password:values.p_new
|
|
|
|
|
}).then((result)=>{
|
|
|
|
|
if(result){
|
|
|
|
|
this.props.showNotification("密码更新成功!");
|
|
|
|
|
this.setState({
|
|
|
|
|
updating:''
|
|
|
|
|
})
|
|
|
|
|
this.props.getBasicInfo();
|
|
|
|
|
}
|
|
|
|
|
}).catch((error)=>{
|
|
|
|
|
console.log(error);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
@ -164,6 +187,25 @@ class AccountSecure extends Component {
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 修改密码-判断规则
|
|
|
|
|
comfirmNewPassword=(rule,value,callback)=>{
|
|
|
|
|
const { form } = this.props;
|
|
|
|
|
if (value != form.getFieldsValue().p_new) {
|
|
|
|
|
callback("两次输入的新密码必须一致!");
|
|
|
|
|
}else {
|
|
|
|
|
callback();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
InputNewPassword=(rule,value,callback)=>{
|
|
|
|
|
const { form } = this.props;
|
|
|
|
|
if (value.length<8 || value.length>12) {
|
|
|
|
|
callback("请输入8-12个字符的新密码,区分大小写!");
|
|
|
|
|
}else {
|
|
|
|
|
callback();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
let {basicInfo}=this.props;
|
|
|
|
|
const { getFieldDecorator } = this.props.form;
|
|
|
|
@ -189,7 +231,7 @@ class AccountSecure extends Component {
|
|
|
|
|
color: #CDCDCD;
|
|
|
|
|
}
|
|
|
|
|
.description span {
|
|
|
|
|
margin-right: 8px;
|
|
|
|
|
margin-right: 20px;
|
|
|
|
|
color: #05101A;
|
|
|
|
|
}
|
|
|
|
|
.flexRow .status {
|
|
|
|
@ -402,10 +444,12 @@ class AccountSecure extends Component {
|
|
|
|
|
rules: [{
|
|
|
|
|
// initialValue: this.state.cityDefaultValue,
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请设置8~16位密码,区分大小写',
|
|
|
|
|
message: '请输入8~16位的新密码,区分大小写',
|
|
|
|
|
},{
|
|
|
|
|
validator:this.InputNewPassword
|
|
|
|
|
}],
|
|
|
|
|
})(
|
|
|
|
|
<Input type="password" placeholder="请设置8~16位密码,区分大小写" autoComplete="new-password"></Input>
|
|
|
|
|
<Input type="password" placeholder="请输入8~16位的新密码,区分大小写" autoComplete="new-password"></Input>
|
|
|
|
|
)}
|
|
|
|
|
</Form.Item>
|
|
|
|
|
|
|
|
|
@ -418,6 +462,8 @@ class AccountSecure extends Component {
|
|
|
|
|
// initialValue: this.state.cityDefaultValue,
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请再次输入新密码',
|
|
|
|
|
},{
|
|
|
|
|
validator:this.comfirmNewPassword
|
|
|
|
|
}],
|
|
|
|
|
})(
|
|
|
|
|
<Input type="password" placeholder="请再次输入新密码" autoComplete="new-password"></Input>
|
|
|
|
|