Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. @GetMapping("/user/verification")
  2. @Secured({"ADMIN, USER"})
  3. public String getViewUserValidation(Model model, Principal principal) {
  4. try {
  5. model.addAttribute("user", usersService.getUserDtoForVerificationByUsername(principal.getName()));
  6. return "verification-photos";
  7. } catch (EntityNotFoundException e) {
  8. throw new ResponseStatusException(HttpStatus.NOT_FOUND, e.getMessage());
  9. }
  10.  
  11. }
  12.  
  13. @Secured({"ADMIN, USER"})
  14. @PostMapping("/user/verification")
  15. public String submitUserPhotosForVerification(@ModelAttribute(name = "user") UserDtoForVerification user, @RequestParam("selfiePhoto") MultipartFile selfiePhoto, @RequestParam("personalIdCardPhoto") MultipartFile personalIdCardPhoto, Principal principal) throws IOException {
  16. user.setSelfiePhoto(Base64.getEncoder().encodeToString(selfiePhoto.getBytes()));
  17.  
  18. user.setPersonalIdCardPhoto(Base64.getEncoder().encodeToString(personalIdCardPhoto.getBytes()));
  19.  
  20. usersService.updateUser(principal.getName(), user);
  21.  
  22. return "redirect:/user";
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement