Merge pull request #4797 from stianst/KEYCLOAK-5734

KEYCLOAK-5734
This commit is contained in:
Bill Burke authored and GitHub committed 2017-12-05 17:31:36 -05:00
commit f669fdf0df
3 files changed
+23

No files matched your search

@@ -138,6 +138,7 @@ public class FormAuthenticationFlow implements AuthenticationFlow {
private class ValidationContextImpl extends FormContextImpl implements ValidationContext {
FormAction action;
String error;
boolean excludeOthers;
private ValidationContextImpl(AuthenticationExecutionModel executionModel, FormAction action) {
super(executionModel);
@@ -161,6 +162,11 @@ public class FormAuthenticationFlow implements AuthenticationFlow {
public void success() {
success = true;
}
@Override
public void excludeOtherErrors() {
excludeOthers = true;
}
}
@Override
@@ -222,8 +228,17 @@ public class FormAuthenticationFlow implements AuthenticationFlow {
for (ValidationContextImpl v : errors) {
for (FormMessage m : v.errors) {
if (!fields.contains(m.getField())) {
if (v.excludeOthers) {
fields.clear();
messages.clear();
}
fields.add(m.getField());
messages.add(m);
if (v.excludeOthers) {
break;
}
}
}
}
@@ -127,6 +127,7 @@ public class RegistrationRecaptcha implements FormAction, FormActionFactory, Con
formData.remove(G_RECAPTCHA_RESPONSE);
context.error(Errors.INVALID_REGISTRATION);
context.validationError(formData, errors);
context.excludeOtherErrors();
return;