Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
head_group
xyqb-user2
Commits
71ac09e0
Commit
71ac09e0
authored
Nov 23, 2017
by
技术部-任文超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加log,调试获取短信验证码的图片校验码超时后,使用原captchaId总能校验通过问题
parent
dddd65f5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
0 deletions
+34
-0
RedisCaptchaStore.java
.../cn/quantgroup/xyqb/config/captcha/RedisCaptchaStore.java
+2
-0
SimpleCaptcha.java
...cn/quantgroup/xyqb/thirdparty/jcaptcha/SimpleCaptcha.java
+3
-0
TestStringCode.java
src/test/java/login/TestStringCode.java
+29
-0
No files found.
src/main/java/cn/quantgroup/xyqb/config/captcha/RedisCaptchaStore.java
View file @
71ac09e0
...
@@ -101,7 +101,9 @@ public class RedisCaptchaStore implements CaptchaStore {
...
@@ -101,7 +101,9 @@ public class RedisCaptchaStore implements CaptchaStore {
private
Captcha
getFromRedisThenDel
(
String
captchaId
)
{
private
Captcha
getFromRedisThenDel
(
String
captchaId
)
{
String
captcharKey
=
buildCaptcharKey
(
captchaId
);
String
captcharKey
=
buildCaptcharKey
(
captchaId
);
Long
expire
=
stringRedisTemplate
.
getExpire
(
captcharKey
,
TimeUnit
.
SECONDS
);
Object
value
=
stringRedisTemplate
.
opsForValue
().
get
(
captcharKey
);
Object
value
=
stringRedisTemplate
.
opsForValue
().
get
(
captcharKey
);
LOGGER
.
info
(
"captchaId={},captchaCode={},expire={}秒"
,
captcharKey
,
value
,
expire
);
stringRedisTemplate
.
delete
(
captcharKey
);
stringRedisTemplate
.
delete
(
captcharKey
);
return
value
!=
null
?
new
SimpleCaptcha
(
captchaId
,
String
.
valueOf
(
value
))
:
null
;
return
value
!=
null
?
new
SimpleCaptcha
(
captchaId
,
String
.
valueOf
(
value
))
:
null
;
}
}
...
...
src/main/java/cn/quantgroup/xyqb/thirdparty/jcaptcha/SimpleCaptcha.java
View file @
71ac09e0
...
@@ -34,6 +34,9 @@ public class SimpleCaptcha extends ImageCaptcha {
...
@@ -34,6 +34,9 @@ public class SimpleCaptcha extends ImageCaptcha {
}
}
private
Boolean
validateResponse
(
String
response
)
{
private
Boolean
validateResponse
(
String
response
)
{
if
(
StringUtils
.
isBlank
(
this
.
response
)
||
StringUtils
.
isBlank
(
response
)){
return
false
;
}
return
StringUtils
.
equals
(
this
.
response
,
response
);
return
StringUtils
.
equals
(
this
.
response
,
response
);
}
}
...
...
src/test/java/login/TestStringCode.java
0 → 100644
View file @
71ac09e0
package
login
;
import
java.nio.charset.Charset
;
import
java.util.Base64
;
public
class
TestStringCode
{
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
base64
(
"13511112222"
,
"000000"
));
System
.
out
.
println
(
base64
(
"18022223333"
,
"000000"
));
}
final
static
String
AUTHORIZATION
=
"authorization"
;
final
static
String
PREFIX
=
"Basic "
;
/*
* 4.153
* 13576450525 123456 318e235d3e52648b236faa3f748000d5
* 13724823305 123456 318e235d3e52648b236faa3f748000d5
*
* 4.155
* 13511112222 000000 c8937b92506c0e2918de053dea69edd3
* 18022223333 000000 c8937b92506c0e2918de053dea69edd3
*/
final
static
String
base64
(
String
account
,
String
password
)
{
String
authorization
=
PREFIX
+
new
String
(
Base64
.
getEncoder
().
encodeToString
((
account
+
":"
+
password
).
getBytes
(
Charset
.
forName
(
"UTF-8"
))));
return
authorization
;
}
}
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