Formatting changes, remote admin bundle from git
This commit is contained in:
parent
140721b542
commit
cfa6dc3c0b
@ -64,13 +64,17 @@ public class RegistrationController {
|
|||||||
log.warn("Registration input has errors!");
|
log.warn("Registration input has errors!");
|
||||||
return "redirect:registration?error";
|
return "redirect:registration?error";
|
||||||
}
|
}
|
||||||
if (userService.getUser(userRegistrationDTO.getUserName()).isPresent()) {
|
if (userService.getUser(userRegistrationDTO.getUserName())
|
||||||
|
.isPresent()) {
|
||||||
return "redirect:registration?error&duplicate=true";
|
return "redirect:registration?error&duplicate=true";
|
||||||
}
|
}
|
||||||
|
|
||||||
log.debug("Captcha text from user input = {}", userRegistrationDTO.getCaptchaInput());
|
log.debug("Captcha text from user input = {}",
|
||||||
log.debug("Captcha text from captcha map = {}", captchaMap.get(userRegistrationDTO.getCaptchaID()));
|
userRegistrationDTO.getCaptchaInput());
|
||||||
if (userRegistrationDTO.getCaptchaInput().equals(captchaMap.get(userRegistrationDTO.getCaptchaID()))) {
|
log.debug("Captcha text from captcha map = {}",
|
||||||
|
captchaMap.get(userRegistrationDTO.getCaptchaID()));
|
||||||
|
if (userRegistrationDTO.getCaptchaInput()
|
||||||
|
.equals(captchaMap.get(userRegistrationDTO.getCaptchaID()))) {
|
||||||
log.info("Registration captcha equal success");
|
log.info("Registration captcha equal success");
|
||||||
userService.createUser(userRegistrationDTO);
|
userService.createUser(userRegistrationDTO);
|
||||||
return "redirect:registration?success";
|
return "redirect:registration?success";
|
||||||
@ -81,12 +85,14 @@ public class RegistrationController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(value = "/img/captcha/{image_id}", produces = MediaType.IMAGE_PNG_VALUE)
|
@GetMapping(value = "/img/captcha/{image_id}", produces = MediaType.IMAGE_PNG_VALUE)
|
||||||
public ResponseEntity<byte[]> getImage(@PathVariable("image_id") Long imageId) throws IOException {
|
public ResponseEntity<byte[]> getImage(
|
||||||
|
@PathVariable("image_id") Long imageId) throws IOException {
|
||||||
|
|
||||||
final String captchaText = captchaMap.get(imageId);
|
final String captchaText = captchaMap.get(imageId);
|
||||||
final HttpHeaders headers = new HttpHeaders();
|
final HttpHeaders headers = new HttpHeaders();
|
||||||
headers.setContentType(MediaType.IMAGE_PNG);
|
headers.setContentType(MediaType.IMAGE_PNG);
|
||||||
BufferedImage captchaBufferedImage = captchaService.createCaptchaImage(captchaText);
|
BufferedImage captchaBufferedImage = captchaService
|
||||||
|
.createCaptchaImage(captchaText);
|
||||||
|
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
ImageIO.write(captchaBufferedImage, "png", baos);
|
ImageIO.write(captchaBufferedImage, "png", baos);
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user