|
@ -179,6 +179,7 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
|
|
|
}
|
|
|
patient.setSalt(randomString(5));
|
|
|
patient.setPassword(MD5.md5Hex(newPassword + "{" + patient.getSalt() + "}"));
|
|
|
save(patient);
|
|
|
return ConstantUtils.SUCCESS;
|
|
|
}
|
|
|
|
|
@ -330,4 +331,36 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
|
|
|
}
|
|
|
return patient;
|
|
|
}
|
|
|
|
|
|
public Map<String,Object> resetPwd(String id, String password, String captcha) {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
//增加密码
|
|
|
if (password.length() < 6 || password.length() > 20) {
|
|
|
map.put("code", -1);
|
|
|
map.put("message", "密码长度需为6-20位");
|
|
|
return map;
|
|
|
}
|
|
|
BasePatientDO patient = basePatientDao.findOne(id);
|
|
|
String mobile = patient.getMobile();
|
|
|
// 对验证码进行校验
|
|
|
int res = baseSmsService.check(mobile, 2, captcha);
|
|
|
if (-2 == res) {
|
|
|
map.put("code", -1);
|
|
|
map.put("message", "验证码已过期!");
|
|
|
return map;
|
|
|
} else if (-1 == res) {
|
|
|
map.put("code", -1);
|
|
|
map.put("message", "请输入正确的验证码!");
|
|
|
return map;
|
|
|
} else if (0 == res) {
|
|
|
map.put("code", -1);
|
|
|
map.put("message", "验证码无效!");
|
|
|
return map;
|
|
|
} else {
|
|
|
resetPassword(id, password);
|
|
|
map.put("code", 1);
|
|
|
map.put("message", "设置成功!");
|
|
|
}
|
|
|
return map;
|
|
|
}
|
|
|
}
|