|
@ -306,41 +306,19 @@ public class LoginController extends BaseController {
|
|
|
|
|
|
if (type == 2) {
|
|
if (type == 2) {
|
|
// 医生端
|
|
// 医生端
|
|
Doctor doctor = doctorService.findDoctorByMobile(mobile);
|
|
|
|
if (doctor == null) {
|
|
|
|
return error(-1, "操作失败:此用户未注册");
|
|
|
|
} else {
|
|
|
|
int res = smsService.check(mobile, type, captcha);
|
|
|
|
switch (res) {
|
|
|
|
case -2:
|
|
|
|
return error(-1, "验证码已过期!");
|
|
|
|
case -1:
|
|
|
|
return error(-1, "验证码错误!");
|
|
|
|
case 0:
|
|
|
|
return error(-1, "验证码无效!");
|
|
|
|
}
|
|
|
|
|
|
Doctor doctor = doctorService.findDoctorByMobile(mobile);
|
|
String password = RSAUtils.getInstance(doctorService).decryptString(newpwd);
|
|
String password = RSAUtils.getInstance(doctorService).decryptString(newpwd);
|
|
password=StringUtils.reverse(password);
|
|
password=StringUtils.reverse(password);
|
|
password=MD5.GetMD5Code(password+doctor.getSalt());
|
|
password=MD5.GetMD5Code(password+doctor.getSalt());
|
|
doctor.setPassword(password);
|
|
doctor.setPassword(password);
|
|
doctorService.updateDoctorPwd(doctor);
|
|
doctorService.updateDoctorPwd(doctor);
|
|
return success("操作成功!");
|
|
return success("操作成功!");
|
|
}
|
|
|
|
} else {
|
|
} else {
|
|
// 患者端
|
|
// 患者端
|
|
Patient patientTemp = patientService.findByIdcard(idcard);
|
|
Patient patientTemp = patientService.findByIdcard(idcard);
|
|
if (patientTemp == null) {
|
|
if (patientTemp == null) {
|
|
return error(-1, "操作失败:此用户未注册");
|
|
return error(-1, "操作失败:此用户未注册");
|
|
} else {
|
|
} else {
|
|
int res = smsService.check(patientTemp.getMobile(), type, captcha);
|
|
|
|
switch (res) {
|
|
|
|
case -2:
|
|
|
|
return error(-1, "验证码已过期!");
|
|
|
|
case -1:
|
|
|
|
return error(-1, "验证码错误!");
|
|
|
|
case 0:
|
|
|
|
return error(-1, "验证码无效!");
|
|
|
|
}
|
|
|
|
String password = RSAUtils.getInstance(doctorService).decryptString(newpwd);
|
|
String password = RSAUtils.getInstance(doctorService).decryptString(newpwd);
|
|
password=StringUtils.reverse(password);
|
|
password=StringUtils.reverse(password);
|
|
password=MD5.GetMD5Code(password+patientTemp.getSalt());
|
|
password=MD5.GetMD5Code(password+patientTemp.getSalt());
|