Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nouiWithSpringMVC
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
gechengyang
nouiWithSpringMVC
Commits
84a7c0d7
Commit
84a7c0d7
authored
Sep 17, 2020
by
WeiCong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化集群模式后台验证码唯一标志策略
parent
43816448
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
6 deletions
+16
-6
LoginController.java
...org/sss/presentation/noui/controller/LoginController.java
+8
-5
VerifyCodeCreateController.java
...sentation/noui/controller/VerifyCodeCreateController.java
+8
-1
No files found.
src/main/java/org/sss/presentation/noui/controller/LoginController.java
View file @
84a7c0d7
...
...
@@ -4,10 +4,7 @@ import log.Log;
import
log.LogFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.*
;
import
org.sss.common.model.ILoginContext
;
import
org.sss.common.model.IMenuItem
;
import
org.sss.presentation.noui.api.model.Menu
;
...
...
@@ -50,7 +47,13 @@ public class LoginController {
String
dncode
=
noUiRequest
.
getDataMap
().
get
(
Constants
.
DNCODE
)
==
null
?
null
:
noUiRequest
.
getDataMap
().
get
(
Constants
.
DNCODE
).
toString
();
String
sendcode
=
noUiRequest
.
getDataMap
().
get
(
Constants
.
SENDCODE
)
==
null
?
null
:
noUiRequest
.
getDataMap
().
get
(
Constants
.
SENDCODE
).
toString
();
// String verifycode = request.getSession().getAttribute(Constants.VERIFYCODE)==null?null:request.getSession().getAttribute(Constants.VERIFYCODE).toString();
Object
verifycodeobj
=
RedisUtil
.
get
(
request
.
getRequestedSessionId
());
StringBuilder
key
=
new
StringBuilder
(
sendcode
);
if
(!
StringUtil
.
isEmpty
(
request
.
getRemoteAddr
())){
key
.
append
(
request
.
getRemoteAddr
());
}
String
kb
=
key
.
toString
().
toLowerCase
();
log
.
info
(
"key==="
+
kb
);
Object
verifycodeobj
=
RedisUtil
.
get
(
kb
);
String
verifycode
=
verifycodeobj
==
null
?
null
:
verifycodeobj
.
toString
();
map
.
put
(
"j_username"
,
userId
);
map
.
put
(
"j_password"
,
password
);
...
...
src/main/java/org/sss/presentation/noui/controller/VerifyCodeCreateController.java
View file @
84a7c0d7
...
...
@@ -12,6 +12,7 @@ import org.sss.presentation.noui.api.response.NoUiVersion;
import
org.sss.presentation.noui.api.response.ResultUtil
;
import
org.sss.presentation.noui.util.NoUiUtils
;
import
org.sss.presentation.noui.util.RedisUtil
;
import
org.sss.presentation.noui.util.StringUtil
;
import
javax.imageio.ImageIO
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -66,7 +67,13 @@ public class VerifyCodeCreateController {
g
.
drawString
(
code
,
(
i
*
18
)
+
10
,
30
);
codes
.
append
(
code
);
}
RedisUtil
.
set
(
request
.
getRequestedSessionId
(),
codes
.
toString
());
StringBuilder
key
=
new
StringBuilder
(
codes
);
if
(!
StringUtil
.
isEmpty
(
request
.
getRemoteAddr
())){
key
.
append
(
request
.
getRemoteAddr
());
}
String
kb
=
key
.
toString
().
toLowerCase
();
log
.
info
(
"key==="
+
kb
);
RedisUtil
.
set
(
kb
,
codes
.
toString
());
// request.getSession().setAttribute(Constants.VERIFYCODE, codes.toString());
ImageIO
.
write
(
bi
,
"JPG"
,
response
.
getOutputStream
());
...
...
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