Commit 656586ed authored by zhouqian's avatar zhouqian

rename some method, clear the semantic

parent 892d1ba3
...@@ -63,9 +63,12 @@ public class UserController implements IBaseController { ...@@ -63,9 +63,12 @@ public class UserController implements IBaseController {
'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
@RequestMapping("/login") @RequestMapping("/login")
public JsonResult login2(HttpServletRequest request) { public JsonResult login2(@RequestParam(required = false, defaultValue = "") String userId, HttpServletRequest request) {
if (userId != null && userId.length() > 10) {
userService.findByUuidInDb()
} else {
String credential = request.getHeader("authorization"); String credential = request.getHeader("authorization");
if(!credential.startsWith("Basic ")){ if (!credential.startsWith("Basic ")) {
return JsonResult.buildErrorStateResult("用户名或密码不正确", null); return JsonResult.buildErrorStateResult("用户名或密码不正确", null);
} }
credential = credential.substring("Basic ".length(), credential.length()); credential = credential.substring("Basic ".length(), credential.length());
...@@ -73,17 +76,17 @@ public class UserController implements IBaseController { ...@@ -73,17 +76,17 @@ public class UserController implements IBaseController {
String bufStr = ""; String bufStr = "";
try { try {
bufStr = new String(buf, "UTF-8"); bufStr = new String(buf, "UTF-8");
} catch (UnsupportedEncodingException e){ } catch (UnsupportedEncodingException e) {
LOGGER.error("不支持的编码: ", e); LOGGER.error("不支持的编码: ", e);
} }
String[] credentialArr = bufStr.split(":"); String[] credentialArr = bufStr.split(":");
if(credentialArr.length != 2){ if (credentialArr.length != 2) {
return JsonResult.buildErrorStateResult("用户名或密码不正确.", null); return JsonResult.buildErrorStateResult("用户名或密码不正确.", null);
} }
String userName = credentialArr[0]; String userName = credentialArr[0];
String pass = credentialArr[1]; String pass = credentialArr[1];
User user = userService.findByPhoneWithCache(userName); User user = userService.findByPhoneWithCache(userName);
if(user == null){ if (user == null) {
return JsonResult.buildErrorStateResult("用户名或密码不正确", null); return JsonResult.buildErrorStateResult("用户名或密码不正确", null);
} }
//验证密码 //验证密码
...@@ -98,6 +101,7 @@ public class UserController implements IBaseController { ...@@ -98,6 +101,7 @@ public class UserController implements IBaseController {
authBean.setToken(sessionStruct.getSid()); authBean.setToken(sessionStruct.getSid());
return new JsonResult(authBean); return new JsonResult(authBean);
} }
}
@RequestMapping("/test") @RequestMapping("/test")
public JsonResult test() { public JsonResult test() {
...@@ -364,7 +368,7 @@ public class UserController implements IBaseController { ...@@ -364,7 +368,7 @@ public class UserController implements IBaseController {
return JsonResult.buildSuccessResult("token校验成功", userModel); return JsonResult.buildSuccessResult("token校验成功", userModel);
} }
public User registerFastWhenLogin(String phoneNo, Long channelId, Long registerFrom, String appChannel) { private User registerFastWhenLogin(String phoneNo, Long channelId, Long registerFrom, String appChannel) {
String password = genRandomPwd(); String password = genRandomPwd();
LOGGER.info("用户快速注册, phoneNo:{}, verificationCode:{}, channelId:{}, registerFrom:{},appChannel:{}", phoneNo, channelId, registerFrom, appChannel); LOGGER.info("用户快速注册, phoneNo:{}, verificationCode:{}, channelId:{}, registerFrom:{},appChannel:{}", phoneNo, channelId, registerFrom, appChannel);
if (!ValidationUtil.validatePhoneNo(phoneNo)) { if (!ValidationUtil.validatePhoneNo(phoneNo)) {
......
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