Formatting changes, remote admin bundle from git

This commit is contained in:
Rohan Sircar 2020-07-20 19:29:54 +05:30
parent 140721b542
commit cfa6dc3c0b
2 changed files with 12 additions and 22837 deletions

View File

@ -64,13 +64,17 @@ public class RegistrationController {
log.warn("Registration input has errors!");
return "redirect:registration?error";
}
if (userService.getUser(userRegistrationDTO.getUserName()).isPresent()) {
if (userService.getUser(userRegistrationDTO.getUserName())
.isPresent()) {
return "redirect:registration?error&duplicate=true";
}
log.debug("Captcha text from user input = {}", userRegistrationDTO.getCaptchaInput());
log.debug("Captcha text from captcha map = {}", captchaMap.get(userRegistrationDTO.getCaptchaID()));
if (userRegistrationDTO.getCaptchaInput().equals(captchaMap.get(userRegistrationDTO.getCaptchaID()))) {
log.debug("Captcha text from user input = {}",
userRegistrationDTO.getCaptchaInput());
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");
userService.createUser(userRegistrationDTO);
return "redirect:registration?success";
@ -81,12 +85,14 @@ public class RegistrationController {
}
@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 HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.IMAGE_PNG);
BufferedImage captchaBufferedImage = captchaService.createCaptchaImage(captchaText);
BufferedImage captchaBufferedImage = captchaService
.createCaptchaImage(captchaText);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(captchaBufferedImage, "png", baos);

File diff suppressed because one or more lines are too long