Browse Source

feat:[登录] 锁屏,只允许同时1个地方登录

master
memorylkf 3 weeks ago
parent
commit
51a935f694
2 changed files with 21 additions and 11 deletions
  1. +12
    -11
      hxhq-auth/src/main/java/com/hxhq/auth/service/SysLoginService.java
  2. +9
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/controller/SysUserController.java

+ 12
- 11
hxhq-auth/src/main/java/com/hxhq/auth/service/SysLoginService.java View File

@ -89,6 +89,18 @@ public class SysLoginService
LoginUser userInfo = userResult.getData(); LoginUser userInfo = userResult.getData();
SysUser user = userResult.getData().getSysUser(); SysUser user = userResult.getData().getSysUser();
if (UserStatus.DELETED.getCode().equals(user.getDelFlag()))
{
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "对不起,您的账号已被删除");
throw new ServiceException("对不起,您的账号:" + username + " 已被删除");
}
if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
{
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户已停用,请联系管理员");
throw new ServiceException("对不起,您的账号:" + username + " 已停用");
}
passwordService.validate(user, password);
if (!soloLogin) if (!soloLogin)
{ {
// 如果用户不允许多终端同时登录清除缓存信息 // 如果用户不允许多终端同时登录清除缓存信息
@ -105,17 +117,6 @@ public class SysLoginService
} }
} }
if (UserStatus.DELETED.getCode().equals(user.getDelFlag()))
{
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "对不起,您的账号已被删除");
throw new ServiceException("对不起,您的账号:" + username + " 已被删除");
}
if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
{
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户已停用,请联系管理员");
throw new ServiceException("对不起,您的账号:" + username + " 已停用");
}
passwordService.validate(user, password);
recordLogService.recordLogininfor(username, Constants.LOGIN_SUCCESS, "登录成功"); recordLogService.recordLogininfor(username, Constants.LOGIN_SUCCESS, "登录成功");
recordLoginInfo(user.getUserId()); recordLoginInfo(user.getUserId());
return userInfo; return userInfo;

+ 9
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/controller/SysUserController.java View File

@ -77,6 +77,15 @@ public class SysUserController extends BaseController
/** /**
* 获取用户列表 * 获取用户列表
*/ */
@GetMapping("/checkStatus")
public AjaxResult checkStatus()
{
return AjaxResult.success();
}
/**
* 获取用户列表
*/
@RequiresPermissions("system:user:list") @RequiresPermissions("system:user:list")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysUser user) public TableDataInfo list(SysUser user)

Loading…
Cancel
Save