Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
sc_media
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
注册表
注册表
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
svn
sc_media
Commits
4a84bf4d
提交
4a84bf4d
authored
5月 05, 2019
作者:
renjiancai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
上级
fa922dc8
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
20 行增加
和
6 行删除
+20
-6
UserController.java
.../com/zrqx/resource/bg/controller/user/UserController.java
+20
-6
没有找到文件。
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/controller/user/UserController.java
浏览文件 @
4a84bf4d
...
...
@@ -3,6 +3,8 @@ package com.zrqx.resource.bg.controller.user;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.concurrent.TimeUnit
;
...
...
@@ -23,6 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
import
com.zrqx.core.constant.resource.ResourceRequestPath
;
import
com.zrqx.core.constant.sysuser.SysUserRequestPath
;
import
com.zrqx.core.enums.ResponseCodeEnum
;
import
com.zrqx.core.exception.BaseException
;
import
com.zrqx.core.form.sysuser.bg.user.UpdatePasswordForm
;
import
com.zrqx.core.form.sysuser.bg.user.UpdateUserBasicsForm
;
...
...
@@ -68,16 +71,27 @@ public class UserController {
throw
new
BaseException
(
"验证码不能为空"
);
}
String
errorCount
=
stringRedisTemplate
.
opsForValue
().
get
(
name
);
if
(
StringUtils
.
isNotBlank
(
errorCount
)
&&
Integer
.
parseInt
(
errorCount
)
>=
3
){
throw
new
BaseException
(
"密码错误次数过多"
);
if
(
StringUtils
.
isNotBlank
(
errorCount
)
&&
Integer
.
parseInt
(
errorCount
)
>=
5
){
throw
new
BaseException
(
ResponseCodeEnum
.
VALIDATE
);
//密码输入错误次数过多,输入验证码
}
String
redisCode
=
stringRedisTemplate
.
opsForValue
().
get
(
uuid
);
if
(
code
==
null
||
redisCode
==
null
||
!
code
.
toLowerCase
().
equals
(
redisCode
.
toLowerCase
())){
throw
new
BaseException
(
"验证码有误"
);
if
(
StringUtils
.
isNotBlank
(
errorCount
)
&&
Integer
.
parseInt
(
errorCount
)
>=
5
){
String
redisCode
=
stringRedisTemplate
.
opsForValue
().
get
(
uuid
);
if
(
code
==
null
||
redisCode
==
null
||
!
code
.
toLowerCase
().
equals
(
redisCode
.
toLowerCase
())){
throw
new
BaseException
(
"验证码有误"
);
}
}
stringRedisTemplate
.
delete
(
uuid
);
User
user
=
userSerivce
.
login
(
name
);
//查看账号是否冻结
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
if
((
new
Date
().
getTime
()-
format
.
parse
(
user
.
getFreezetime
().
toString
()).
getTime
()>
6
*
60
*
1000
)){
user
.
setFreezetime
(
null
);
userSerivce
.
updateByCriteria
(
user
);
}
if
(
StringUtils
.
isNotBlank
(
errorCount
)
&&
Integer
.
parseInt
(
errorCount
)
>=
15
){
user
.
setFreezetime
(
new
Date
());
throw
new
BaseException
(
"您的账号已冻结,密码输入次数超过15次,请10分钟以后在再来登录"
);
}
if
(
user
==
null
){
throw
new
BaseException
(
"账号或密码错误"
);
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论