65 MultivaluedMap<String, String> formData = context.getHttpRequest().getDecodedFormParameters();
66 List<FormMessage> errors =
new ArrayList<>();
67 context.getEvent().detail(Details.REGISTER_METHOD,
"form");
68 if (Validation.isBlank(formData.getFirst(RegistrationPage.FIELD_PASSWORD))) {
69 errors.add(
new FormMessage(RegistrationPage.FIELD_PASSWORD, Messages.MISSING_PASSWORD));
70 }
else if (!formData.getFirst(RegistrationPage.FIELD_PASSWORD).equals(formData.getFirst(RegistrationPage.FIELD_PASSWORD_CONFIRM))) {
71 errors.add(
new FormMessage(RegistrationPage.FIELD_PASSWORD_CONFIRM, Messages.INVALID_PASSWORD_CONFIRM));
73 if (formData.getFirst(RegistrationPage.FIELD_PASSWORD) != null) {
74 PolicyError err = context.getSession().getProvider(PasswordPolicyManagerProvider.class).validate(context.getRealm().isRegistrationEmailAsUsername() ? formData.getFirst(RegistrationPage.FIELD_EMAIL) : formData.getFirst(RegistrationPage.FIELD_USERNAME), formData.getFirst(RegistrationPage.FIELD_PASSWORD));
76 errors.add(
new FormMessage(RegistrationPage.FIELD_PASSWORD, err.getMessage(), err.getParameters()));
79 if (errors.size() > 0) {
80 context.error(Errors.INVALID_REGISTRATION);
81 formData.remove(RegistrationPage.FIELD_PASSWORD);
82 formData.remove(RegistrationPage.FIELD_PASSWORD_CONFIRM);
83 context.validationError(formData, errors);