Merge pull request #71 from vrockai/KEYCLOAK-107

KEYCLOAK-107 fix for login form error feedback issues
This commit is contained in:
Bill Burke 2013-10-16 05:10:33 -07:00
commit 34bf8c7e2c
3 changed files with 13 additions and 9 deletions

View file

@ -31,18 +31,16 @@
<div class="form-area ${(realm.social)?string('social','')} clearfix"> <div class="form-area ${(realm.social)?string('social','')} clearfix">
<div class="section app-form"> <div class="section app-form">
<h3>Application login area</h3> <h3>Application login area</h3>
<#if error?has_content>
<div class="feedback error bottom-left show">
<p>
<strong id="loginError">${rb.getString(error.summary)}</strong><br/>${rb.getString('emailErrorInfo')}
</p>
</div>
</#if>
<#nested "form"> <#nested "form">
</div> </div>
<#if error?has_content>
<div class="
error bottom-left show">
<p>
<strong id="loginError">${rb.getString(error.summary)}</strong>
</p>
</div>
</#if>
<#if social.displaySocialProviders> <#if social.displaySocialProviders>
<div class="section social-login"> <span>or</span> <div class="section social-login"> <span>or</span>
<h3>Social login area</h3> <h3>Social login area</h3>

View file

@ -53,4 +53,5 @@ emailForgotHeader=Forgot Your Password?
emailUpdateHeader=Update password emailUpdateHeader=Update password
emailSent=You should receive an email shortly with further instructions. emailSent=You should receive an email shortly with further instructions.
emailError=Invalid username or email. 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. emailInstruction=Enter your username and email address and we will send you instructions on how to create a new password.

View file

@ -192,6 +192,11 @@ public class TokenService {
String username = formData.getFirst("username"); String username = formData.getFirst("username");
UserModel user = realm.getUser(username); UserModel user = realm.getUser(username);
if (user == null){
return Flows.forms(realm, request, uriInfo).setError(Messages.INVALID_USER).setFormData(formData)
.forwardToLogin();
}
isTotpConfigurationRequired(user); isTotpConfigurationRequired(user);
isEmailVerificationRequired(user); isEmailVerificationRequired(user);