Commit 4c3b3444 authored by minminyan's avatar minminyan

免密登陆时,如果用户已经注销,就直接提示登录失败

parent 99da3774
...@@ -63,14 +63,13 @@ public class AppController implements IBaseController { ...@@ -63,14 +63,13 @@ public class AppController implements IBaseController {
/** /**
* 第三方用户登录 * 第三方用户登录
*
*/ */
@RequestMapping("/login") @RequestMapping("/login")
public JsonResult login( public JsonResult login(
String phoneNo, String phoneNo,
@RequestParam(required = false, defaultValue = "1") Long registerFrom, @RequestParam(required = false, defaultValue = "1") Long registerFrom,
@RequestParam(required = false, defaultValue = "1") Long channelId, @RequestParam(required = false, defaultValue = "1") Long channelId,
String idNo, String name, String key, @RequestParam(required = false, defaultValue = "")String appChannel, HttpServletRequest request String idNo, String name, String key, @RequestParam(required = false, defaultValue = "") String appChannel, HttpServletRequest request
) { ) {
if (!ValidationUtil.validatePhoneNo(phoneNo)) { if (!ValidationUtil.validatePhoneNo(phoneNo)) {
return JsonResult.buildErrorStateResult("该用户名不存在,<br/>请重新输入或注册新账号。", null); return JsonResult.buildErrorStateResult("该用户名不存在,<br/>请重新输入或注册新账号。", null);
...@@ -85,6 +84,9 @@ public class AppController implements IBaseController { ...@@ -85,6 +84,9 @@ public class AppController implements IBaseController {
if (user == null) { if (user == null) {
return JsonResult.buildErrorStateResult("该用户名不存在,<br/>请重新输入或注册新账号。", null); return JsonResult.buildErrorStateResult("该用户名不存在,<br/>请重新输入或注册新账号。", null);
} }
if (!user.getEnable()) {
return JsonResult.buildErrorStateResult("登录失败", null);
}
Merchant merchant = merchantService.findMerchantByName(key); Merchant merchant = merchantService.findMerchantByName(key);
if (merchant == null) { if (merchant == null) {
return JsonResult.buildErrorStateResult("无效的商户", null); return JsonResult.buildErrorStateResult("无效的商户", null);
...@@ -104,14 +106,13 @@ public class AppController implements IBaseController { ...@@ -104,14 +106,13 @@ public class AppController implements IBaseController {
/** /**
* 第三方用户登录并返回用户信息 * 第三方用户登录并返回用户信息
*
*/ */
@RequestMapping("/login_super") @RequestMapping("/login_super")
public JsonResult loginSuper ( public JsonResult loginSuper(
String phoneNo, String phoneNo,
@RequestParam(required = false, defaultValue = "1") Long registerFrom, @RequestParam(required = false, defaultValue = "1") Long registerFrom,
@RequestParam(required = false, defaultValue = "1") Long channelId, @RequestParam(required = false, defaultValue = "1") Long channelId,
String idNo, String name, String key, @RequestParam(required = false, defaultValue = "")String appChannel, HttpServletRequest request String idNo, String name, String key, @RequestParam(required = false, defaultValue = "") String appChannel, HttpServletRequest request
) { ) {
if (!ValidationUtil.validatePhoneNo(phoneNo)) { if (!ValidationUtil.validatePhoneNo(phoneNo)) {
return JsonResult.buildErrorStateResult("该用户名不存在,<br/>请重新输入或注册新账号。", null); return JsonResult.buildErrorStateResult("该用户名不存在,<br/>请重新输入或注册新账号。", null);
...@@ -126,6 +127,9 @@ public class AppController implements IBaseController { ...@@ -126,6 +127,9 @@ public class AppController implements IBaseController {
if (user == null) { if (user == null) {
return JsonResult.buildErrorStateResult("该用户名不存在,<br/>请重新输入或注册新账号。", null); return JsonResult.buildErrorStateResult("该用户名不存在,<br/>请重新输入或注册新账号。", null);
} }
if (!user.getEnable()) {
return JsonResult.buildErrorStateResult("登录失败", null);
}
Merchant merchant = merchantService.findMerchantByName(key); Merchant merchant = merchantService.findMerchantByName(key);
if (merchant == null) { if (merchant == null) {
return JsonResult.buildErrorStateResult("无效的商户", null); return JsonResult.buildErrorStateResult("无效的商户", null);
...@@ -166,7 +170,7 @@ public class AppController implements IBaseController { ...@@ -166,7 +170,7 @@ public class AppController implements IBaseController {
LOGGER.info("第三方登录用户,保存 User"); LOGGER.info("第三方登录用户,保存 User");
User user = new User(); User user = new User();
if(channelId == 222L) { if (channelId == 222L) {
user.setRegisteredFrom(channelId); user.setRegisteredFrom(channelId);
} else { } else {
user.setRegisteredFrom(registerFrom); user.setRegisteredFrom(registerFrom);
...@@ -180,7 +184,7 @@ public class AppController implements IBaseController { ...@@ -180,7 +184,7 @@ public class AppController implements IBaseController {
user.setCreatedAt(currentTime); user.setCreatedAt(currentTime);
userRepository.saveAndFlush(user); userRepository.saveAndFlush(user);
if(registerFrom != 645L) { if (registerFrom != 645L) {
smsService.sendAfterRegister(phoneNo); smsService.sendAfterRegister(phoneNo);
LOGGER.info("第三方登录用户注册成功, registerFrom:{}, phoneNo:{}, 并且已发送短信通知", registerFrom, phoneNo); LOGGER.info("第三方登录用户注册成功, registerFrom:{}, phoneNo:{}, 并且已发送短信通知", registerFrom, 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