diff --git a/forms/common-themes/src/main/resources/theme/login/base/login-update-password.ftl b/forms/common-themes/src/main/resources/theme/login/base/login-update-password.ftl index d5348e1a31d..bbc69a27f4f 100755 --- a/forms/common-themes/src/main/resources/theme/login/base/login-update-password.ftl +++ b/forms/common-themes/src/main/resources/theme/login/base/login-update-password.ftl @@ -1,9 +1,9 @@ <#import "template.ftl" as layout> <@layout.registrationLayout displayInfo=true; section> <#if section = "title"> - ${rb.emailUpdateHeader} + ${rb.updatePasswordTitle} <#elseif section = "header"> - ${rb.emailUpdateHeader} + ${rb.updatePasswordTitle} <#elseif section = "form">
diff --git a/forms/common-themes/src/main/resources/theme/login/base/messages/messages_en.properties b/forms/common-themes/src/main/resources/theme/login/base/messages/messages_en.properties index 50337e6f404..4cfbfcad703 100755 --- a/forms/common-themes/src/main/resources/theme/login/base/messages/messages_en.properties +++ b/forms/common-themes/src/main/resources/theme/login/base/messages/messages_en.properties @@ -20,6 +20,8 @@ oauthGrantTitleHtml=Temporary access for {0} requested by sorry ... emailVerifyTitle=Email verification +emailForgotTitle=Forgot Your Password? +updatePasswordTitle=Update password noAccount=New user? username=Username @@ -46,6 +48,10 @@ emailVerifyInstruction1=An email with instructions to verify your email address emailVerifyInstruction2=Haven't received a verification code in your email? emailVerifyInstruction3=to re-send the email. +backToLogin=« Back to Login + +emailInstruction=Enter your username or email address and we will send you instructions on how to create a new password. + invalidUserMessage=Invalid username or password. invalidEmailMessage=Invalid email address. accountDisabledMessage=Account is disabled, contact admin. @@ -70,62 +76,43 @@ emailExistsMessage=Email already exists. federatedIdentityEmailExistsMessage=User with email already exists. Please login to account management to link the account. federatedIdentityUsernameExistsMessage=User with username already exists. Please login to account management to link the account. +configureTotpMessage=You need to set up Mobile Authenticator to activate your account. +updateProfileMessage=You need to update your user profile to activate your account. +updatePasswordMessage=You need to change your password to activate your account. +verifyEmailMessage=You need to verify your email address to activate your account. + +emailSentMessage=You should receive an email shortly with further instructions. +emailSendErrorMessage=Failed to send email, please try again later + +accountUpdatedMessage=Your account has been updated +accountPasswordUpdatedMessage=Your password has been updated + +noAccessMessage=No access + +invalidPasswordMinLengthMessage=Invalid password: minimum length {0} +invalidPasswordMinDigitsMessage=Invalid password: must contain at least {0} numerical digits +invalidPasswordMinLowerCaseCharsMessage=Invalid password: must contain at least {0} lower case characters +invalidPasswordMinUpperCaseCharsMessage=Invalid password: must contain at least {0} upper case characters +invalidPasswordMinSpecialCharsMessage=Invalid password: must contain at least {0} special characters + +failedToProcessResponseMessage=Failed to process response +httpsRequiredMessage=HTTPS required +realmNotEnabledMessage=Realm not enabled +invalidRequestMessage=Invalid Request +unknownLoginRequesterMessage=Unknown login requester +loginRequesterNotEnabledMessage=Login requester not enabled +bearerOnlyMessage=Bearer-only applications are not allowed to initiate browser login +directGrantsOnlyMessage=Direct-grants-only clients are not allowed to initiate browser login +invalidRedirectUriMessage=Invalid redirect uri +unsupportedNameIdFormatMessage=Unsupported NameIDFormat +invlidRequesterMessage=Invalid requester +registrationNotAllowedMessage=Registration not allowed - - - -actionTotpWarning=You need to set up Mobile Authenticator to activate your account. -actionProfileWarning=You need to update your user profile to activate your account. -actionPasswordWarning=You need to change your password to activate your account. -actionEmailWarning=You need to verify your email address to activate your account. -actionFollow=Please fill in the fields below. - -errorKerberosLogin=Kerberos ticket not available. Authenticate with password. - -successHeader=Success! -errorHeader=Error! - -# Forgot password part - -emailForgotHeader=Forgot Your Password? -backToLogin=« Back to Login -emailUpdateHeader=Update password -emailSent=You should receive an email shortly with further instructions. -emailSendError=Failed to send email, please try again later -emailError=Invalid email. -emailErrorInfo=Please, fill in the fields again. -emailInstruction=Enter your username or email address and we will send you instructions on how to create a new password. - -accountUpdated=Your account has been updated -accountPasswordUpdated=Your password has been updated - -noAccess=No access - -invalidPasswordMinLength=Invalid password: minimum length {0} -invalidPasswordMinDigits=Invalid password\: must contain at least {0} numerical digits -invalidPasswordMinLowerCaseChars=Invalid password\: must contain at least {0} lower case characters -invalidPasswordMinUpperCaseChars=Invalid password: must contain at least {0} upper case characters -invalidPasswordMinSpecialChars=Invalid password: must contain at least {0} special characters - -failedToProcessResponse=Failed to process response -httpsRequired=HTTPS required -realmNotEnabled=Realm not enabled -invalidRequest=Invalid Request -unknownLoginRequester=Unknown login requester -loginRequesterNotEnabled=Login requester not enabled -bearerOnly=Bearer-only applications are not allowed to initiate browser login -directGrantsOnly=Direct-grants-only clients are not allowed to initiate browser login -invalidRedirectUri=Invalid redirect uri -unsupportedNameIdFormat=Unsupported NameIDFormat -invlidRequester=Invalid requester -registrationNotAllowed=Registration not allowed - permissionNotApproved=Permission not approved. noRelayStateInResponse=No relay state in response from identity provider [{0}]. identityProviderAlreadyLinked=The identity returned by the identity provider [{0}] is already linked to another user. -userDisabled="User is disabled." insufficientPermission=Insufficient permissions to link identities. couldNotProceedWithAuthenticationRequest=Could not proceed with authentication request to identity provider. couldNotObtainToken=Could not obtain token from identity provider [{0}]. @@ -138,6 +125,8 @@ invalidAccessCode=Invalid access code. sessionNotActive=Session not active. unknownCode=Unknown code, please login again through your application. invalidCode=Invalid code, please login again through your application. + + identityProviderUnexpectedError=Unexpected error when authenticating with identity provider identityProviderNotFound=Could not find an identity provider with the identifier [{0}]. identityProviderNoToken=Could not obtain token from identity provider [{0}]. diff --git a/forms/login-freemarker/src/main/java/org/keycloak/login/freemarker/FreeMarkerLoginFormsProvider.java b/forms/login-freemarker/src/main/java/org/keycloak/login/freemarker/FreeMarkerLoginFormsProvider.java index 7d926a493fe..6ad3dab3013 100755 --- a/forms/login-freemarker/src/main/java/org/keycloak/login/freemarker/FreeMarkerLoginFormsProvider.java +++ b/forms/login-freemarker/src/main/java/org/keycloak/login/freemarker/FreeMarkerLoginFormsProvider.java @@ -97,15 +97,15 @@ import java.util.concurrent.TimeUnit; switch (action) { case CONFIGURE_TOTP: - actionMessage = Messages.ACTION_WARN_TOTP; + actionMessage = Messages.CONFIGURE_TOTP; page = LoginFormsPages.LOGIN_CONFIG_TOTP; break; case UPDATE_PROFILE: - actionMessage = Messages.ACTION_WARN_PROFILE; + actionMessage = Messages.UPDATE_PROFILE; page = LoginFormsPages.LOGIN_UPDATE_PROFILE; break; case UPDATE_PASSWORD: - actionMessage = Messages.ACTION_WARN_PASSWD; + actionMessage = Messages.UPDATE_PASSWORD; page = LoginFormsPages.LOGIN_UPDATE_PASSWORD; break; case VERIFY_EMAIL: @@ -122,7 +122,7 @@ import java.util.concurrent.TimeUnit; return setError(Messages.EMAIL_SENT_ERROR).createErrorPage(); } - actionMessage = Messages.ACTION_WARN_EMAIL; + actionMessage = Messages.VERIFY_EMAIL; page = LoginFormsPages.LOGIN_VERIFY_EMAIL; break; default: diff --git a/model/api/src/main/java/org/keycloak/models/PasswordPolicy.java b/model/api/src/main/java/org/keycloak/models/PasswordPolicy.java index e74b9712c8c..a6d2221b283 100755 --- a/model/api/src/main/java/org/keycloak/models/PasswordPolicy.java +++ b/model/api/src/main/java/org/keycloak/models/PasswordPolicy.java @@ -10,6 +10,12 @@ import java.util.List; */ public class PasswordPolicy { + public static final String INVALID_PASSWORD_MIN_LENGTH_MESSAGE = "invalidPasswordMinLengthMessage"; + public static final String INVALID_PASSWORD_MIN_DIGITS_MESSAGE = "invalidPasswordMinDigitsMessage"; + public static final String INVALID_PASSWORD_MIN_LOWER_CASE_CHARS_MESSAGE = "invalidPasswordMinLowerCaseCharsMessage"; + public static final String INVALID_PASSWORD_MIN_UPPER_CASE_CHARS_MESSAGE = "invalidPasswordMinUpperCaseCharsMessage"; + public static final String INVALID_PASSWORD_MIN_SPECIAL_CHARS_MESSAGE = "invalidPasswordMinSpecialCharsMessage"; + private List policies; private String policyString; @@ -131,7 +137,7 @@ public class PasswordPolicy { @Override public Error validate(String password) { - return password.length() < min ? new Error("invalidPasswordMinLength", min) : null; + return password.length() < min ? new Error(INVALID_PASSWORD_MIN_LENGTH_MESSAGE, min) : null; } } @@ -151,7 +157,7 @@ public class PasswordPolicy { count++; } } - return count < min ? new Error("invalidPasswordMinDigits", min) : null; + return count < min ? new Error(INVALID_PASSWORD_MIN_DIGITS_MESSAGE, min) : null; } } @@ -171,7 +177,7 @@ public class PasswordPolicy { count++; } } - return count < min ? new Error("invalidPasswordMinLowerCaseChars", min): null; + return count < min ? new Error(INVALID_PASSWORD_MIN_LOWER_CASE_CHARS_MESSAGE, min): null; } } @@ -191,7 +197,7 @@ public class PasswordPolicy { count++; } } - return count < min ? new Error("invalidPasswordMinUpperCaseChars", min) : null; + return count < min ? new Error(INVALID_PASSWORD_MIN_UPPER_CASE_CHARS_MESSAGE, min) : null; } } @@ -211,7 +217,7 @@ public class PasswordPolicy { count++; } } - return count < min ? new Error("invalidPasswordMinSpecialChars", min) : null; + return count < min ? new Error(INVALID_PASSWORD_MIN_SPECIAL_CHARS_MESSAGE, min) : null; } } diff --git a/services/src/main/java/org/keycloak/services/messages/Messages.java b/services/src/main/java/org/keycloak/services/messages/Messages.java index 14659ff89f1..3384bb2b6ac 100755 --- a/services/src/main/java/org/keycloak/services/messages/Messages.java +++ b/services/src/main/java/org/keycloak/services/messages/Messages.java @@ -64,73 +64,55 @@ public class Messages { public static final String FEDERATED_IDENTITY_USERNAME_EXISTS = "federatedIdentityUsernameExistsMessage"; + public static final String CONFIGURE_TOTP = "configureTotpMessage"; + + public static final String UPDATE_PROFILE = "updateProfileMessage"; + + public static final String UPDATE_PASSWORD = "updatePasswordMessage"; + + public static final String VERIFY_EMAIL = "verifyEmailMessage"; + + public static final String EMAIL_SENT = "emailSentMessage"; + + public static final String EMAIL_SENT_ERROR = "emailSendErrorMessage"; + + public static final String ACCOUNT_UPDATED = "accountUpdatedMessage"; + + public static final String ACCOUNT_PASSWORD_UPDATED = "accountPasswordUpdatedMessage"; + + public static final String NO_ACCESS = "noAccessMessage"; + + public static final String FAILED_TO_PROCESS_RESPONSE = "failedToProcessResponseMessage"; + + public static final String HTTPS_REQUIRED = "httpsRequiredMessage"; + + public static final String REALM_NOT_ENABLED = "realmNotEnabledMessage"; + + public static final String INVALID_REQUEST = "invalidRequestMessage"; + + public static final String INVALID_REQUESTER = "invalidRequesterMessage"; + + public static final String UNKNOWN_LOGIN_REQUESTER = "unknownLoginRequesterMessage"; + + public static final String LOGIN_REQUESTER_NOT_ENABLED = "loginRequesterNotEnabledMessage"; + + public static final String BEARER_ONLY = "bearerOnlyMessage"; + + public static final String DIRECT_GRANTS_ONLY = "directGrantsOnlyMessage"; + + public static final String INVALID_REDIRECT_URI = "invalidRedirectUriMessage"; + + public static final String UNSUPPORTED_NAME_ID_FORMAT = "unsupportedNameIdFormatMessage"; + + public static final String REGISTRATION_NOT_ALLOWED = "registrationNotAllowedMessage"; - public static final String READ_ONLY_USER = "readOnlyUser"; - public static final String READ_ONLY_PASSWORD = "readOnlyPassword"; - public static final String ACTION_WARN_TOTP = "actionTotpWarning"; - public static final String ACTION_WARN_PROFILE = "actionProfileWarning"; - public static final String ACTION_WARN_PASSWD = "actionPasswordWarning"; - public static final String ACTION_WARN_EMAIL = "actionEmailWarning"; - public static final String MISSING_IDENTITY_PROVIDER = "missingIdentityProvider"; - - public static final String INVALID_FEDERATED_IDENTITY_ACTION = "invalidFederatedIdentityAction"; - - public static final String IDENTITY_PROVIDER_NOT_FOUND = "identityProviderNotFound"; - - public static final String FEDERATED_IDENTITY_NOT_ACTIVE = "federatedIdentityLinkNotActive"; - - public static final String FEDERATED_IDENTITY_REMOVING_LAST_PROVIDER = "federatedIdentityRemovingLastProvider"; - - public static final String IDENTITY_PROVIDER_REDIRECT_ERROR = "identityProviderRedirectError"; - - public static final String IDENTITY_PROVIDER_REMOVED = "identityProviderRemoved"; - - public static final String IDENTITY_PROVIDER_UNEXPECTED_ERROR = "identityProviderUnexpectedError"; - - public static final String IDENTITY_PROVIDER_NO_TOKEN = "identityProviderNoToken"; - - public static final String ERROR = "error"; - - public static final String REALM_SUPPORTS_NO_CREDENTIALS = "realmSupportsNoCredentials"; - - public static final String IDENTITY_PROVIDER_NOT_UNIQUE = "identityProviderNotUnique"; - - public static final String NO_ACCESS = "noAccess"; - - public static final String EMAIL_SENT = "emailSent"; - - public static final String EMAIL_SENT_ERROR = "emailSendError"; - - public static final String FAILED_TO_PROCESS_RESPONSE = "failedToProcessResponse"; - - public static final String HTTPS_REQUIRED = "httpsRequired"; - - public static final String REALM_NOT_ENABLED = "realmNotEnabled"; - - public static final String INVALID_REQUEST = "invalidRequest"; - - public static final String INVALID_REQUESTER = "invalidRequester"; - - public static final String UNKNOWN_LOGIN_REQUESTER = "unknownLoginRequester"; - - public static final String LOGIN_REQUESTER_NOT_ENABLED = "loginRequesterNotEnabled"; - - public static final String BEARER_ONLY = "bearerOnly"; - - public static final String DIRECT_GRANTS_ONLY = "directGrantsOnly"; - - public static final String INVALID_REDIRECT_URI = "invalidRedirectUri"; - - public static final String UNSUPPORTED_NAME_ID_FORMAT = "unsupportedNameIdFormat"; - - public static final String REGISTRATION_NOT_ALLOWED = "registrationNotAllowed"; public static final String PERMISSION_NOT_APPROVED = "permissionNotApproved"; @@ -138,8 +120,6 @@ public class Messages { public static final String IDENTITY_PROVIDER_ALREADY_LINKED = "identityProviderAlreadyLinked"; - public static final String USER_DISABLED = "userDisabled"; - public static final String INSUFFICIENT_PERMISSION = "insufficientPermission"; public static final String COULD_NOT_PROCEED_WITH_AUTHENTICATION_REQUEST = "couldNotProceedWithAuthenticationRequest"; @@ -164,5 +144,32 @@ public class Messages { public static final String INVALID_CODE = "invalidCode"; + public static final String IDENTITY_PROVIDER_UNEXPECTED_ERROR = "identityProviderUnexpectedError"; + public static final String IDENTITY_PROVIDER_NOT_FOUND = "identityProviderNotFound"; + + + public static final String READ_ONLY_USER = "readOnlyUser"; + + public static final String READ_ONLY_PASSWORD = "readOnlyPassword"; + + public static final String MISSING_IDENTITY_PROVIDER = "missingIdentityProvider"; + + public static final String INVALID_FEDERATED_IDENTITY_ACTION = "invalidFederatedIdentityAction"; + + public static final String FEDERATED_IDENTITY_NOT_ACTIVE = "federatedIdentityLinkNotActive"; + + public static final String FEDERATED_IDENTITY_REMOVING_LAST_PROVIDER = "federatedIdentityRemovingLastProvider"; + + public static final String IDENTITY_PROVIDER_REDIRECT_ERROR = "identityProviderRedirectError"; + + public static final String IDENTITY_PROVIDER_REMOVED = "identityProviderRemoved"; + + public static final String IDENTITY_PROVIDER_NO_TOKEN = "identityProviderNoToken"; + + public static final String ERROR = "error"; + + public static final String REALM_SUPPORTS_NO_CREDENTIALS = "realmSupportsNoCredentials"; + + public static final String IDENTITY_PROVIDER_NOT_UNIQUE = "identityProviderNotUnique"; } diff --git a/services/src/main/java/org/keycloak/services/resources/AccountService.java b/services/src/main/java/org/keycloak/services/resources/AccountService.java index 9c7e273a9d5..861c9156f38 100755 --- a/services/src/main/java/org/keycloak/services/resources/AccountService.java +++ b/services/src/main/java/org/keycloak/services/resources/AccountService.java @@ -426,7 +426,7 @@ public class AccountService { event.clone().event(EventType.UPDATE_EMAIL).detail(Details.PREVIOUS_EMAIL, oldEmail).detail(Details.UPDATED_EMAIL, email).success(); } setReferrerOnPage(); - return account.setSuccess("accountUpdated").createResponse(AccountPages.ACCOUNT); + return account.setSuccess(Messages.ACCOUNT_UPDATED).createResponse(AccountPages.ACCOUNT); } catch (ModelReadOnlyException roe) { setReferrerOnPage(); return account.setError(Messages.READ_ONLY_USER).setProfileFormData(formData).createResponse(AccountPages.ACCOUNT); @@ -619,7 +619,7 @@ public class AccountService { event.event(EventType.UPDATE_PASSWORD).client(auth.getClient()).user(auth.getUser()).success(); setReferrerOnPage(); - return account.setPasswordSet(true).setSuccess("accountPasswordUpdated").createResponse(AccountPages.PASSWORD); + return account.setPasswordSet(true).setSuccess(Messages.ACCOUNT_PASSWORD_UPDATED).createResponse(AccountPages.PASSWORD); } @Path("federated-identity-update") diff --git a/services/src/main/java/org/keycloak/services/resources/IdentityBrokerService.java b/services/src/main/java/org/keycloak/services/resources/IdentityBrokerService.java index 75aa142dd3b..a6eff59d7fc 100644 --- a/services/src/main/java/org/keycloak/services/resources/IdentityBrokerService.java +++ b/services/src/main/java/org/keycloak/services/resources/IdentityBrokerService.java @@ -363,7 +363,7 @@ public class IdentityBrokerService { if (!authenticatedUser.isEnabled()) { fireErrorEvent(Errors.USER_DISABLED); - return redirectToErrorPage(Messages.USER_DISABLED); + return redirectToErrorPage(Messages.ACCOUNT_DISABLED); } if (!authenticatedUser.hasRole(this.realmModel.getApplicationByName(ACCOUNT_MANAGEMENT_APP).getRole(MANAGE_ACCOUNT))) {