Commit e9182f2c authored by linlinjava's avatar linlinjava
Browse files

#468

parent ba439aa7
......@@ -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;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment