Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
zhengyuan-danger-chemistry-manage
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
耿迪迪
zhengyuan-danger-chemistry-manage
Commits
87649777
Commit
87649777
authored
Mar 01, 2023
by
吴卿华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
app 记住密码登录
parent
cc3d41c6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
14 deletions
+29
-14
SysLoginController.java
.../com/zehong/web/controller/system/SysLoginController.java
+5
-5
LoginBody.java
...n/java/com/zehong/common/core/domain/model/LoginBody.java
+15
-1
SysLoginService.java
...ava/com/zehong/framework/web/service/SysLoginService.java
+9
-8
No files found.
danger-manage-admin/src/main/java/com/zehong/web/controller/system/SysLoginController.java
View file @
87649777
...
...
@@ -23,7 +23,7 @@ import com.zehong.system.service.ISysMenuService;
/**
* 登录验证
*
*
* @author zehong
*/
@RestController
...
...
@@ -46,7 +46,7 @@ public class SysLoginController
/**
* 登录方法
*
*
* @param loginBody 登录信息
* @return 结果
*/
...
...
@@ -56,14 +56,14 @@ public class SysLoginController
AjaxResult
ajax
=
AjaxResult
.
success
();
// 生成令牌
String
token
=
loginService
.
login
(
loginBody
.
getUsername
(),
loginBody
.
getPassword
(),
loginBody
.
getCode
(),
loginBody
.
getUuid
());
loginBody
.
getUuid
()
,
loginBody
.
getRememberPsw
()
);
ajax
.
put
(
Constants
.
TOKEN
,
token
);
return
ajax
;
}
/**
* 获取用户信息
*
*
* @return 用户信息
*/
@GetMapping
(
"getInfo"
)
...
...
@@ -85,7 +85,7 @@ public class SysLoginController
/**
* 获取路由信息
*
*
* @return 路由信息
*/
@GetMapping
(
"getRouters"
)
...
...
danger-manage-common/src/main/java/com/zehong/common/core/domain/model/LoginBody.java
View file @
87649777
...
...
@@ -2,7 +2,7 @@ package com.zehong.common.core.domain.model;
/**
* 用户登录对象
*
*
* @author zehong
*/
public
class
LoginBody
...
...
@@ -27,6 +27,20 @@ public class LoginBody
*/
private
String
uuid
=
""
;
/**
* 手机端 记住密码登录 验证是否通过验证码
* @return
*/
private
int
rememberPsw
;
public
int
getRememberPsw
()
{
return
rememberPsw
;
}
public
void
setRememberPsw
(
int
rememberPsw
)
{
this
.
rememberPsw
=
rememberPsw
;
}
public
String
getUsername
()
{
return
username
;
...
...
danger-manage-framework/src/main/java/com/zehong/framework/web/service/SysLoginService.java
View file @
87649777
...
...
@@ -25,7 +25,7 @@ import com.zehong.system.service.ISysUserService;
/**
* 登录校验方法
*
*
* @author zehong
*/
@Component
...
...
@@ -39,20 +39,20 @@ public class SysLoginService
@Autowired
private
RedisCache
redisCache
;
@Autowired
private
ISysUserService
userService
;
/**
* 登录验证
*
*
* @param username 用户名
* @param password 密码
* @param code 验证码
* @param uuid 唯一标识
* @return 结果
*/
public
String
login
(
String
username
,
String
password
,
String
code
,
String
uuid
)
public
String
login
(
String
username
,
String
password
,
String
code
,
String
uuid
,
int
rememberPsw
)
{
String
verifyKey
=
Constants
.
CAPTCHA_CODE_KEY
+
uuid
;
String
captcha
=
redisCache
.
getCacheObject
(
verifyKey
);
...
...
@@ -62,10 +62,11 @@ public class SysLoginService
AsyncManager
.
me
().
execute
(
AsyncFactory
.
recordLogininfor
(
username
,
Constants
.
LOGIN_FAIL
,
MessageUtils
.
message
(
"user.jcaptcha.expire"
)));
throw
new
CaptchaExpireException
();
}
if
(!
code
.
equalsIgnoreCase
(
captcha
))
{
AsyncManager
.
me
().
execute
(
AsyncFactory
.
recordLogininfor
(
username
,
Constants
.
LOGIN_FAIL
,
MessageUtils
.
message
(
"user.jcaptcha.error"
)));
throw
new
CaptchaException
();
if
(
rememberPsw
!=
1
)
{
if
(!
code
.
equalsIgnoreCase
(
captcha
))
{
AsyncManager
.
me
().
execute
(
AsyncFactory
.
recordLogininfor
(
username
,
Constants
.
LOGIN_FAIL
,
MessageUtils
.
message
(
"user.jcaptcha.error"
)));
throw
new
CaptchaException
();
}
}
// 用户验证
Authentication
authentication
=
null
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment