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
d52ada59
提交
d52ada59
authored
5月 08, 2019
作者:
renjiancai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
上级
ba2ef77e
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
20 行增加
和
3 行删除
+20
-3
UserController.java
.../com/zrqx/resource/bg/controller/user/UserController.java
+5
-2
Redis.java
...source/src/main/java/com/zrqx/resource/commons/Redis.java
+15
-1
没有找到文件。
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/controller/user/UserController.java
浏览文件 @
d52ada59
...
...
@@ -96,10 +96,11 @@ public class UserController {
}
String
ip
=
CusAccessObjectUtil
.
getIpAddress
(
request
);
String
errorCount
=
redis
.
get
(
ip
);
//账号或密码错误 5次以上 需填写验证码
/*String errorCount = stringRedisTemplate.opsForValue().get(name);*/
if
(
StringUtils
.
isNotBlank
(
errorCount
)
&&
Integer
.
parseInt
(
errorCount
)
>=
5
){
/*
if(StringUtils.isNotBlank(errorCount) && Integer.parseInt(errorCount) >=5){
throw new BaseException(ResponseCodeEnum.VALIDATE);//密码输入错误次数过多,输入验证码
}
}
*/
if
(
StringUtils
.
isNotBlank
(
errorCount
)
&&
Integer
.
parseInt
(
errorCount
)
>=
5
){
if
(
code
==
null
){
throw
new
BaseException
(
"验证码不能为空"
);
...
...
@@ -118,6 +119,8 @@ public class UserController {
throw
new
BaseException
(
"该账户已禁用"
);
}
if
(
password
==
null
||
!
password
.
toLowerCase
().
equals
(
user
.
getPassword
().
toLowerCase
())){
errorCount
=
StringUtils
.
isBlank
(
errorCount
)
?
"1"
:
Integer
.
parseInt
(
errorCount
)
+
1
+
""
;
redis
.
set
(
ip
,
errorCount
,
60
*
5
);
throw
new
BaseException
(
"账号或密码错误"
);
}
//查看账号是否冻结
...
...
com.zrqx.resource/src/main/java/com/zrqx/resource/commons/Redis.java
浏览文件 @
d52ada59
...
...
@@ -3,6 +3,7 @@ package com.zrqx.resource.commons;
import
java.io.IOException
;
import
java.util.Enumeration
;
import
java.util.concurrent.TimeUnit
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -106,5 +107,18 @@ public class Redis {
public
static
String
getFgToken
(){
return
getToken
(
FG_TOKEN
);
}
/**
* 获取前台登录用户信息
*
* @return
*/
public
String
fmtObj
(
Object
obj
)
throws
IOException
{
return
obj
instanceof
String
?
obj
.
toString
():
JsonUtil
.
bean2Json
(
obj
);
}
public
void
set
(
String
token
,
Object
obj
,
long
timeout
,
TimeUnit
unit
)
throws
IOException
{
stringRedisTemplate
.
opsForValue
().
set
(
token
,
fmtObj
(
obj
),
timeout
,
unit
);
}
public
void
set
(
String
token
,
Object
obj
,
long
timeout
)
throws
IOException
{
stringRedisTemplate
.
opsForValue
().
set
(
token
,
fmtObj
(
obj
),
timeout
,
TimeUnit
.
SECONDS
);
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论