diff --git a/forms/src/main/resources/META-INF/resources/forms/theme/default/template-login.ftl b/forms/src/main/resources/META-INF/resources/forms/theme/default/template-login.ftl index ac7e4961f4..de023e1bfb 100644 --- a/forms/src/main/resources/META-INF/resources/forms/theme/default/template-login.ftl +++ b/forms/src/main/resources/META-INF/resources/forms/theme/default/template-login.ftl @@ -31,18 +31,16 @@

Application login area

+ <#if error?has_content> + + <#nested "form">
- <#if error?has_content> -
-

- ${rb.getString(error.summary)} -

-
- - <#if social.displaySocialProviders>
or

Social login area

diff --git a/forms/src/main/resources/org/keycloak/forms/messages.properties b/forms/src/main/resources/org/keycloak/forms/messages.properties index 67b737fc85..03943dc0e1 100644 --- a/forms/src/main/resources/org/keycloak/forms/messages.properties +++ b/forms/src/main/resources/org/keycloak/forms/messages.properties @@ -53,4 +53,5 @@ emailForgotHeader=Forgot Your Password? emailUpdateHeader=Update password emailSent=You should receive an email shortly with further instructions. emailError=Invalid username or email. +emailErrorInfo=Please, fill in the fields again. emailInstruction=Enter your username and email address and we will send you instructions on how to create a new password. \ No newline at end of file diff --git a/services/src/main/java/org/keycloak/services/resources/TokenService.java b/services/src/main/java/org/keycloak/services/resources/TokenService.java index ae4c014bbf..6bc3e0b240 100755 --- a/services/src/main/java/org/keycloak/services/resources/TokenService.java +++ b/services/src/main/java/org/keycloak/services/resources/TokenService.java @@ -192,6 +192,11 @@ public class TokenService { String username = formData.getFirst("username"); UserModel user = realm.getUser(username); + if (user == null){ + return Flows.forms(realm, request, uriInfo).setError(Messages.INVALID_USER).setFormData(formData) + .forwardToLogin(); + } + isTotpConfigurationRequired(user); isEmailVerificationRequired(user);