@Bean public AccountsController accountsController(AccountCreationService accountCreationService, IdentityProviderProvisioning identityProviderProvisioning) { return new AccountsController(accountCreationService, identityProviderProvisioning); }
private String handleSelfServiceDisabled(Model model, HttpServletResponse response, String attributeKey, String attributeValue) { model.addAttribute(attributeKey, attributeValue); updateModelWithConsentAttributes(model); response.setStatus(HttpStatus.NOT_FOUND.value()); return "error"; }
@RequestMapping(value = "/create_account", method = GET) public String activationEmail(Model model, @RequestParam(value = "client_id", required = false) String clientId, @RequestParam(value = "redirect_uri", required = false) String redirectUri, HttpServletResponse response) { if(!IdentityZoneHolder.get().getConfig().getLinks().getSelfService().isSelfServiceLinksEnabled()) { return handleSelfServiceDisabled(model, response, "error_message_code", "self_service_disabled"); } model.addAttribute("client_id", clientId); model.addAttribute("redirect_uri", redirectUri); updateModelWithConsentAttributes(model); return "accounts/new_activation_email"; }
return handleUnprocessableEntity(model, response, "error_message_code", "missing_consent"); return handleSelfServiceDisabled(model, response, "error_message_code", "self_service_disabled"); return handleUnprocessableEntity(model, response, "error_message_code", "invalid_email"); if(!identityProviderList.isEmpty()) { model.addAttribute("email", email.getEmail()); return handleUnprocessableEntity(model, response, "error_message_code", "other_idp"); return handleUnprocessableEntity(model, response, "error_message_code", validation.getMessageCode()); return handleUnprocessableEntity(model, response, "error_message_code", "username_exists"); } catch (InvalidPasswordException e) { return handleUnprocessableEntity(model, response, "error_message", e.getMessagesAsOneString());
@Bean AccountsController accountsController(AccountCreationService accountCreationService, IdentityProviderProvisioning identityProviderProvisioning) { return new AccountsController(accountCreationService, identityProviderProvisioning); } }
private String handleUnprocessableEntity(Model model, HttpServletResponse response, String attributeKey, String attributeValue) { model.addAttribute(attributeKey, attributeValue); updateModelWithConsentAttributes(model); response.setStatus(HttpStatus.UNPROCESSABLE_ENTITY.value()); return "accounts/new_activation_email"; }