{this.getInfoContent(formData.type)}
{i18n.message.checkVCode()}
})
this.getCheckForm().then(data => {
if(data.status === '1'){
this.setFormData('checkForm', data.conditions);
this.step = 2;
if(['phoneCode', 'emailCode'].indexOf(formData.type) > -1){
this.sendBtnLabel = `${this.t.toString()}s`;
this.showTimeout = false;
this.checkTimer = setInterval(() => {
this.sendBtnLabel = `${(--this.t).toString()}s`;
if(this.t === 0){
this.showTimeout = true;
this.sendBtnLabel = i18n.button.resend();
clearInterval(this.checkTimer);
}
}, 1000);
}
this.refreshVerificationCode();
}else{
this.hint({
content: data.message
});
this.refreshVerificationCode();
}
this.spinning = false;
})
}else{
this.getCheckForm().then(data => {
if(data.status === '1'){
this.setFormData('checkForm', data.conditions);
this.step = 2;
this.refreshVerificationCode();
}else{
this.hint({
content: data.message
})
this.refreshVerificationCode();
}
this.spinning = false;
})
}
}else{
this.hint({
content: data.message
});
this.spinning = false;
this.refreshVerificationCode();
}
}, error => {
this.spinning = false;
this.refreshVerificationCode();
})
}else{
this.hint({
content: data.message
});
this.refreshVerificationCode();
this.spinning = false;
}
}, error => {
this.spinning = false;
this.refreshVerificationCode();
})
} else {
this.spinning = false;
this.refreshVerificationCode();
f.showErrors();
this.showError = new Date().getTime();
}
});
}
@action getCheckForm = () => {
switch(this.formTarget.findPasswordForm.getFormParams().type){
case 'phoneCode':
return api.confirmPhoneCodeForm(this.getValidateCodeParam());
case '-1':
return api.passwordQuestionForm(this.getValidateCodeParam());
case 'emailCode':
return api.confirmEmailCodeForm(this.getValidateCodeParam());
}
}
@action checkFormInfo = () => {
if(this.spinning)
return;
this.spinning = true;
this.formTarget.checkForm.validateForm().then(f => {
if (f.isValid) {
const formData = this.formTarget.checkForm.getFormParams();
const findPasswordFormData = this.formTarget.findPasswordForm.getFormParams();
const params = {id: this.id, ...findPasswordFormData, ...formData, languageId: this.langid};
this.doCheck(params).then(data => {
if(data.status === '1'){
api.resetPasswordForm(params).then(data => {
if(data.status === '1'){
this.setFormData('passwordForm', data.conditions);
this.step = 3;
this.refreshVerificationCode();
this.openRSA = data.openRSA;
}else{
message.error(data.message);
this.refreshVerificationCode();
}
}, error => {
this.refreshVerificationCode();
})
}else{
message.error(data.message);
this.refreshVerificationCode();
}
this.spinning = false;
}, error => {
this.spinning = false;
this.refreshVerificationCode();
})
} else {
this.spinning = false;
f.showErrors();
this.showError = new Date().getTime();
this.refreshVerificationCode();
}
});
}
@action doCheck = (params) => {
switch(this.formTarget.findPasswordForm.getFormParams().type){
case 'phoneCode':
return api.confirmPhoneCodeToNext(params);
case '-1':
return api.passwordQuestionToNext(params);
case 'emailCode':
return api.confirmEmailCodeToNext(params);
}
}
@action save = () => {
if(this.spinning)
return;
this.spinning = true;
this.formTarget.passwordForm.validateForm().then(f => {
if (f.isValid) {
const formData = this.formTarget.passwordForm.getFormParams();
if(formData.newpswd != formData.cfmpswd){
message.error(i18n.message.doubleCheckPwdFaild());
this.spinning = false;
this.refreshVerificationCode();
return;
}
const fields = this.formTarget.passwordFormFields;
const otherParams = fields[0].items[0].otherParams;
if(!this.passwordVerification(formData.cfmpswd, otherParams.minpasslen, otherParams.passwordComplexity)){
this.spinning = false;
this.refreshVerificationCode();
return;
}
let RSAParam = {
'newpswd':this.formTarget.passwordForm.getFormParams().newpswd,
'cfmpswd':this.formTarget.passwordForm.getFormParams().cfmpswd
}
RSAEcrypt(this.openRSA,RSAParam).then(RSAParam => {
checkWeakPass(RSAParam.newpswd,()=>{
api.saveResetPassword({id: this.id,
...this.formTarget.findPasswordForm.getFormParams(),
...this.formTarget.checkForm.getFormParams(),
...this.formTarget.passwordForm.getFormParams(),
...RSAParam,
languageId: this.langid
}).then(data => {
let dia = this.getDialogInfo();
if(dia){
dia.callback && dia.callback(data);
dia.close();
}
})
this.spinning = false;
},() => {
this.spinning = false;
this.refreshVerificationCode();
});
})
} else {
this.spinning = false;
f.showErrors();
this.showError = new Date().getTime();
this.refreshVerificationCode();
}
});
}
@action passwordVerification = (val, minPassLen, passwordComplexity) => {
let checkpass = true;
if (val.length < minPassLen) {
message.error(i18n.message.pwdLen() + minPassLen);
return false;
} else if (passwordComplexity == "1") {
const complexity11 = /[a-z]+/;
const complexity12 = /[A-Z]+/;
const complexity13 = /\d+/;
if (complexity11.test(val) && complexity12.test(val) && complexity13.test(val)) {
checkpass = true;
} else {
message.error(i18n.message.pwdType());
checkpass = false;
}
} else if (passwordComplexity == "2") {
const complexity21 = /[a-zA-Z_]+/;
const complexity22 = /\W+/;
const complexity23 = /\d+/;
if (complexity21.test(val) && complexity22.test(val) && complexity23.test(val)) {
checkpass = true;
} else {
message.error(i18n.message.pwdType1());
checkpass = false;
}
}else if(passwordComplexity=="3"){
const complexity31 = /[a-zA-Z_]+/;
const complexity32 = /\d+/;
if(complexity31.test(val)&&complexity32.test(val)){
checkpass = true;
}else{
message.error(i18n.message.pwdType2());
checkpass = false;
}
}
return checkpass;
}
@action resendVCode = () => {
if(this.spinning)
return;
if(this.showTimeout){
this.spinning = true;
const formData = this.formTarget.findPasswordForm.getFormParams();
const checkFormParams = this.formTarget.checkForm.getFormParams();
if(checkFormParams.validatecode === ''){
this.formTarget.checkForm.showError('validatecode', getLabel('84270',"请输入验证码"));
this.spinning = false;
this.refreshVerificationCode();
return;
}
api.forgotPasswordToNext({id: this.id, ...formData, languageId: this.langid, validatecode: checkFormParams.validatecode}).then(data => {
if(data.status === '1'){
this.formTarget.checkForm.resetConditionValue();
this.refreshVerificationCode();
this.showTimeout = false;
this.targetInfo = data.id;
this.hint({
content: