Commit 891fd168 authored by xiaoguang.xu's avatar xiaoguang.xu

注册即修改密码

parent 9218aa7d
......@@ -267,7 +267,10 @@ public class UserController implements IBaseController {
registerFrom = 1L;
}
verifyPhoneAndCode(phoneNo, verificationCode);
if (userService.exist(phoneNo)) {
User user = userService.findByPhoneInDb(phoneNo);
if (user != null) {
user.setPassword(PasswordUtil.MD5WithSalt(password));
userService.saveUser(user);
log.info("用户注册失败,该手机号已经被注册:register -> registerFrom:{}, phoneNo:{}", registerFrom, phoneNo);
//已存在的用户, 经过短信认证, 也认为是注册成功的
return JsonResult.buildSuccessResult(null, null);
......
package cn.quantgroup.xyqb.util;
import cn.quantgroup.xyqb.Constants;
import com.google.common.base.Preconditions;
import java.security.MessageDigest;
......@@ -20,6 +21,10 @@ public class PasswordUtil {
'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'
};
public final static String MD5WithSalt(String s){
return MD5(s.toLowerCase() + Constants.PASSWORD_SALT);
}
public final static String MD5(String s) {
try {
byte[] strTemp = s.getBytes("utf-8");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment