Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
api
Overview
Overview
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
首航-临时账号
api
Commits
abf67aaf
Commit
abf67aaf
authored
Sep 24, 2019
by
zhangyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登陆修改
parent
8334e5d9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
redis.properties
resources/redis.properties
+5
-0
UserController.java
src/com/ejweb/modules/user/api/UserController.java
+8
-5
No files found.
resources/redis.properties
View file @
abf67aaf
...
@@ -13,3 +13,7 @@ redis.ipLimitTimes=10
...
@@ -13,3 +13,7 @@ redis.ipLimitTimes=10
redis.usernameWithinSeconds
=
60
redis.usernameWithinSeconds
=
60
redis.usernameLimitTimes
=
10
redis.usernameLimitTimes
=
10
redis.blackUsernameTime
=
60
redis.blackUsernameTime
=
60
# \u67E5\u5C01\u65F6\u95F4
redis.userSealUpSeconds
=
60
# \u8FC7\u671F\u65F6\u95F4
redis.userOverdueSeconds
=
100
\ No newline at end of file
src/com/ejweb/modules/user/api/UserController.java
View file @
abf67aaf
...
@@ -9,7 +9,6 @@ import com.ejweb.core.conf.GConstants;
...
@@ -9,7 +9,6 @@ import com.ejweb.core.conf.GConstants;
import
com.ejweb.core.fetcher.FetchEntity
;
import
com.ejweb.core.fetcher.FetchEntity
;
import
com.ejweb.core.fetcher.HCFetcher
;
import
com.ejweb.core.fetcher.HCFetcher
;
import
com.ejweb.core.util.IdWorker
;
import
com.ejweb.core.util.IdWorker
;
import
com.ejweb.core.util.PropertiesUtils
;
import
com.ejweb.core.util.RedisUtils
;
import
com.ejweb.core.util.RedisUtils
;
import
com.ejweb.core.util.Util
;
import
com.ejweb.core.util.Util
;
import
com.ejweb.modules.mobile.verify.entity.MobileVerifyEntity
;
import
com.ejweb.modules.mobile.verify.entity.MobileVerifyEntity
;
...
@@ -53,6 +52,10 @@ public class UserController {
...
@@ -53,6 +52,10 @@ public class UserController {
private
int
ipWithinSeconds
;
private
int
ipWithinSeconds
;
@Value
(
"${redis.ipLimitTimes}"
)
@Value
(
"${redis.ipLimitTimes}"
)
private
int
ipLimitTimes
;
private
int
ipLimitTimes
;
@Value
(
"${redis.userSealUpSeconds}"
)
private
int
userSealUpSeconds
;
@Value
(
"${redis.userOverdueSeconds}"
)
private
int
userOverdueSeconds
;
@Value
(
"${redis.usernameWithinSeconds}"
)
@Value
(
"${redis.usernameWithinSeconds}"
)
private
int
usernameWithinSeconds
;
private
int
usernameWithinSeconds
;
@Value
(
"${redis.usernameLimitTimes}"
)
@Value
(
"${redis.usernameLimitTimes}"
)
...
@@ -157,9 +160,9 @@ public class UserController {
...
@@ -157,9 +160,9 @@ public class UserController {
}
}
String
blackUsername
=
redisUtils
.
get
(
"black_username:"
+
loginBean
.
getLoginName
(),
indexDb
);
String
blackUsername
=
redisUtils
.
get
(
"black_username:"
+
loginBean
.
getLoginName
(),
indexDb
);
boolean
sealup
=
false
;
boolean
sealup
=
false
;
if
(
null
!=
redisUsername
&&
Integer
.
parseInt
(
redisUsername
)
>=
usernameLimitTimes
&&
StringUtils
.
isEmpty
(
blackUsername
))
{
if
(
null
!=
redisUsername
&&
Integer
.
parseInt
(
redisUsername
)
>=
5
&&
StringUtils
.
isEmpty
(
blackUsername
))
{
redisUtils
.
set
(
"black_username:"
+
loginBean
.
getLoginName
(),
1
,
indexDb
);
redisUtils
.
set
(
"black_username:"
+
loginBean
.
getLoginName
(),
1
,
indexDb
);
redisUtils
.
expire
(
"black_username:"
+
loginBean
.
getLoginName
(),
blackUsernameTime
,
indexDb
);
redisUtils
.
expire
(
"black_username:"
+
loginBean
.
getLoginName
(),
userSealUpSeconds
,
indexDb
);
sealup
=
true
;
sealup
=
true
;
}
else
if
(
blackUsername
!=
null
)
{
}
else
if
(
blackUsername
!=
null
)
{
sealup
=
true
;
sealup
=
true
;
...
@@ -178,7 +181,7 @@ public class UserController {
...
@@ -178,7 +181,7 @@ public class UserController {
// 用户信息redis初始时间 增加value值
// 用户信息redis初始时间 增加value值
if
(
StringUtils
.
isEmpty
(
redisUsername
))
{
if
(
StringUtils
.
isEmpty
(
redisUsername
))
{
redisUtils
.
set
(
loginBean
.
getLoginName
(),
1
,
indexDb
);
redisUtils
.
set
(
loginBean
.
getLoginName
(),
1
,
indexDb
);
redisUtils
.
expire
(
loginBean
.
getLoginName
(),
user
nameWithin
Seconds
,
indexDb
);
redisUtils
.
expire
(
loginBean
.
getLoginName
(),
user
Overdue
Seconds
,
indexDb
);
}
else
{
}
else
{
redisUtils
.
incrNotResetExpireTime
(
loginBean
.
getLoginName
(),
indexDb
);
redisUtils
.
incrNotResetExpireTime
(
loginBean
.
getLoginName
(),
indexDb
);
}
}
...
@@ -227,7 +230,7 @@ public class UserController {
...
@@ -227,7 +230,7 @@ public class UserController {
// 用户信息redis初始时间 增加value值
// 用户信息redis初始时间 增加value值
if
(
StringUtils
.
isEmpty
(
redisUsername
))
{
if
(
StringUtils
.
isEmpty
(
redisUsername
))
{
redisUtils
.
set
(
loginBean
.
getLoginName
(),
1
,
indexDb
);
redisUtils
.
set
(
loginBean
.
getLoginName
(),
1
,
indexDb
);
redisUtils
.
expire
(
loginBean
.
getLoginName
(),
user
nameWithin
Seconds
,
indexDb
);
redisUtils
.
expire
(
loginBean
.
getLoginName
(),
user
Overdue
Seconds
,
indexDb
);
}
else
{
}
else
{
redisUtils
.
incrNotResetExpireTime
(
loginBean
.
getLoginName
(),
indexDb
);
redisUtils
.
incrNotResetExpireTime
(
loginBean
.
getLoginName
(),
indexDb
);
}
}
...
...
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