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
Litemall
Commits
e9182f2c
Commit
e9182f2c
authored
Mar 14, 2021
by
linlinjava
Browse files
#468
parent
ba439aa7
Changes
1
Hide whitespace changes
Inline
Side-by-side
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminAuthController.java
View file @
e9182f2c
...
...
@@ -25,7 +25,6 @@ import org.springframework.context.ApplicationContext;
import
org.springframework.util.StringUtils
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
sun.misc.BASE64Encoder
;
import
javax.imageio.ImageIO
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -75,10 +74,8 @@ public class AdminAuthController {
try
{
ByteArrayOutputStream
outputStream
=
new
ByteArrayOutputStream
();
ImageIO
.
write
(
image
,
"jpeg"
,
outputStream
);
BASE64Encoder
encoder
=
new
BASE64Encoder
();
String
base64
=
encoder
.
encode
(
outputStream
.
toByteArray
());
String
captchaBase64
=
"data:image/jpeg;base64,"
+
base64
.
replaceAll
(
"\r\n"
,
""
);
return
captchaBase64
;
String
base64
=
Base64
.
getEncoder
().
encodeToString
(
outputStream
.
toByteArray
());
return
"data:image/jpeg;base64,"
+
base64
.
replaceAll
(
"\r\n"
,
""
);
}
catch
(
IOException
e
)
{
return
null
;
}
...
...
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