Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Eladmin
Commits
0e6105c6
Commit
0e6105c6
authored
Sep 05, 2020
by
ZhengJie
Browse files
Merge branch 'master' of github.com:elunez/eladmin
parents
5d920535
9941e0b8
Changes
1
Hide whitespace changes
Inline
Side-by-side
eladmin-system/src/main/java/me/zhengjie/modules/security/rest/AuthorizationController.java
View file @
0e6105c6
...
@@ -27,6 +27,7 @@ import me.zhengjie.annotation.rest.AnonymousGetMapping;
...
@@ -27,6 +27,7 @@ import me.zhengjie.annotation.rest.AnonymousGetMapping;
import
me.zhengjie.annotation.rest.AnonymousPostMapping
;
import
me.zhengjie.annotation.rest.AnonymousPostMapping
;
import
me.zhengjie.config.RsaProperties
;
import
me.zhengjie.config.RsaProperties
;
import
me.zhengjie.exception.BadRequestException
;
import
me.zhengjie.exception.BadRequestException
;
import
me.zhengjie.modules.security.config.bean.LoginCodeEnum
;
import
me.zhengjie.modules.security.config.bean.LoginProperties
;
import
me.zhengjie.modules.security.config.bean.LoginProperties
;
import
me.zhengjie.modules.security.config.bean.SecurityProperties
;
import
me.zhengjie.modules.security.config.bean.SecurityProperties
;
import
me.zhengjie.modules.security.security.TokenProvider
;
import
me.zhengjie.modules.security.security.TokenProvider
;
...
@@ -119,8 +120,13 @@ public class AuthorizationController {
...
@@ -119,8 +120,13 @@ public class AuthorizationController {
// 获取运算的结果
// 获取运算的结果
Captcha
captcha
=
loginProperties
.
getCaptcha
();
Captcha
captcha
=
loginProperties
.
getCaptcha
();
String
uuid
=
properties
.
getCodeKey
()
+
IdUtil
.
simpleUUID
();
String
uuid
=
properties
.
getCodeKey
()
+
IdUtil
.
simpleUUID
();
//当验证码类型为 arithmetic时且长度 >= 2 时,captcha.text()的结果有几率为浮点型
String
captchaValue
=
captcha
.
text
();
if
(
captcha
.
getCharType
()
-
1
==
LoginCodeEnum
.
arithmetic
.
ordinal
()
&&
captchaValue
.
contains
(
"."
))
{
captchaValue
=
captchaValue
.
split
(
"\\."
)[
0
];
}
// 保存
// 保存
redisUtils
.
set
(
uuid
,
captcha
.
text
()
,
loginProperties
.
getLoginCode
().
getExpiration
(),
TimeUnit
.
MINUTES
);
redisUtils
.
set
(
uuid
,
captcha
Value
,
loginProperties
.
getLoginCode
().
getExpiration
(),
TimeUnit
.
MINUTES
);
// 验证码信息
// 验证码信息
Map
<
String
,
Object
>
imgResult
=
new
HashMap
<
String
,
Object
>(
2
)
{{
Map
<
String
,
Object
>
imgResult
=
new
HashMap
<
String
,
Object
>(
2
)
{{
put
(
"img"
,
captcha
.
toBase64
());
put
(
"img"
,
captcha
.
toBase64
());
...
...
Write
Preview
Supports
Markdown
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