From: Roland Häder Date: Mon, 29 Aug 2016 14:17:52 +0000 (+0200) Subject: Please cherry-pick: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d91f335c4e533a6dd6f8b47670d1ab12008aa89a;p=jjobs-war.git Please cherry-pick: - show "user_edit_data" link if at least one of the features is enabled - this allows navigating to e.g. only "user_change_password" - rewrote ugly exceptions to nice faces messages - show message to user if he/she must change password - added missing feature flag for changing email address - added missing file extension (opps, fixed now) - added missing i18n strings Signed-off-by: Roland Häder Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/jjobs/beans/email_address/JobsEmailChangeWebSessionBean.java b/src/java/org/mxchange/jjobs/beans/email_address/JobsEmailChangeWebSessionBean.java index 7fe5248a..bf1328c6 100644 --- a/src/java/org/mxchange/jjobs/beans/email_address/JobsEmailChangeWebSessionBean.java +++ b/src/java/org/mxchange/jjobs/beans/email_address/JobsEmailChangeWebSessionBean.java @@ -106,19 +106,20 @@ public class JobsEmailChangeWebSessionBean extends BaseJobsController implements if (!this.userLoginController.isUserLoggedIn()) { // Not logged-in throw new IllegalStateException("User is not logged-in"); //NOI18N + } else if (!this.featureController.isFeatureEnabled("user_change_email_address")) { //NOI18N + // Editing is not allowed + throw new IllegalStateException("User tried to change email address"); //NOI18N } else if (!this.isRequiredChangeEmailAddressSet()) { // Not all required fields are set throw new FaceletException("Not all required fields are set."); //NOI18N } else if (!Objects.equals(this.getEmailAddress(), this.getEmailAddressRepeat())) { // Email address 1+2 mismatch - throw new FaceletException("Email address 1/2 are mismatching."); //NOI18N + this.showFacesMessage("form_user_change_email_address:emailAddressRepeat", "ERROR_USER_EMAIL_ADDRESSES_MISMATCH"); //NOI18N + return ""; //NOI18N } else if (!this.userLoginController.ifCurrentPasswordMatches()) { // Password not matching - this.showFacesMessage("form_login_change_email_address:currentPassword", "ERROR_USER_CURRENT_PASSWORD_MISMATCHING"); //NOI18N + this.showFacesMessage("form_user_change_email_address:currentPassword", "ERROR_USER_CURRENT_PASSWORD_MISMATCHING"); //NOI18N return ""; //NOI18N - } else if (!this.featureController.isFeatureEnabled("edit_user_data")) { //NOI18N - // Editing is not allowed - throw new IllegalStateException("User tried to edit personal data"); //NOI18N } // Get user instance @@ -134,8 +135,13 @@ public class JobsEmailChangeWebSessionBean extends BaseJobsController implements // Check if the email address is already enqueued if (this.isEmailAddressQueued(this.getEmailAddress())) { + // Clear both email addresses + this.setEmailAddress(null); + this.setEmailAddressRepeat(null); + // Yes, then abort here - return "login_email_already_added"; //NOI18N + this.showFacesMessage("form_user_change_email_address:emailAddress", "ERROR_USER_CHANGE_EMAIL_ADDRESS_ALREADY_QUEUED"); //NOI18N + return ""; //NOI18N } // Create change object, to save EJB calls, the hash is not generated here diff --git a/src/java/org/mxchange/localization/bundle_de_DE.properties b/src/java/org/mxchange/localization/bundle_de_DE.properties index 726aaa69..9f23d635 100644 --- a/src/java/org/mxchange/localization/bundle_de_DE.properties +++ b/src/java/org/mxchange/localization/bundle_de_DE.properties @@ -779,3 +779,14 @@ ADMIN_USER_DELETE_REASON=L\u00f6schgrund: (optional) ADMIN_USER_PASSWORD_REPEAT_DIFFERENT=Your both entered passwords don't match. ADMIN_USER_NAME_ALREADY_EXISTS=Your entered user name does already exist in other user account. ADMIN_USER_ENTERED_SAME_AS_OLD_PASSWORD=You have not changed the password (same as stored entered) +PAGE_TITLE_USER_LOGIN_CHANGE_PASSWORD=Change your user account password +CONTENT_TITLE_USER_LOGIN_CHANGE_PASSWORD=Here you can change your user account password: +USER_MUST_CHANGE_PASSWORD_NOTICE=You have to change your password as this is requested by the administrator. After successful change, you can use your account as usual. +LOGIN_CHANGE_PASSWORD_TITLE=Change your password: +LOGIN_CHANGE_PASSWORD_LEGEND=Please enter twice the new password: +#Das neue Passwort muss zweimal eingegeben werden, um Tippfehler auszuschlie\u00dfen. Dabei darf es mit bereits verwendeten Passw\u00f6rtern nicht \u00fcbereinstimmen. +LOGIN_CHANGE_PASSWORD_LEGEND_TITLE=The new password must be entered twice to avoid typing mistakes. It still must not match older passwords. +ERROR_LOGIN_USER_CHANGE_EMAIL_ADDRESS_DISABLED=Changing of user's email address is administratively deactivated. +#Die von Ihnen eingegebene Email-Adresse hatten Sie bereits zum \u00c4ndern eingegeben. Bitte melden Sie sich beim Support. +ERROR_USER_CHANGE_EMAIL_ADDRESS_ALREADY_QUEUED=You have already entered the email address for changing. Please report to support. +ERROR_USER_EMAIL_ADDRESSES_MISMATCH=Your both entered email addresses are mismatching. diff --git a/src/java/org/mxchange/localization/bundle_en_US.properties b/src/java/org/mxchange/localization/bundle_en_US.properties index 4987f486..542f3c80 100644 --- a/src/java/org/mxchange/localization/bundle_en_US.properties +++ b/src/java/org/mxchange/localization/bundle_en_US.properties @@ -780,3 +780,12 @@ ADMIN_USER_DELETE_REASON=Delete reason: (optional) ADMIN_USER_PASSWORD_REPEAT_DIFFERENT=Die beiden von Ihnen eingegebenen Passw\u00f6rter stimmen nicht \u00fcberein. ADMIN_USER_NAME_ALREADY_EXISTS=Der von Ihnen eingegebene Benutzername existiert bereits (anderes Benutzeraccount). ADMIN_USER_ENTERED_SAME_AS_OLD_PASSWORD=Sie haben das Passwort nicht ge\u00e4ndert (selibiges wie gespeichertes). +PAGE_TITLE_USER_LOGIN_CHANGE_PASSWORD=\u00c4ndern Ihres Zugangspasswortes +CONTENT_TITLE_USER_LOGIN_CHANGE_PASSWORD=\u00c4ndern Sie hier Ihr Zugangspasswort: +USER_MUST_CHANGE_PASSWORD_NOTICE=Sie m\u00fcssen Ihr Passwort \u00e4ndern, da dies vom Administrator so vorgegeben ist. Danach k\u00f6nnen Sie Ihren Account wieder normal verwenden. +LOGIN_CHANGE_PASSWORD_TITLE=\u00c4ndern Sie Ihr Passwort: +LOGIN_CHANGE_PASSWORD_LEGEND=Bitte zweimal das neue Passwort eingeben: +LOGIN_CHANGE_PASSWORD_LEGEND_TITLE=Das neue Passwort muss zweimal eingegeben werden, um Tippfehler auszuschlie\u00dfen. Dabei darf es mit bereits verwendeten Passw\u00f6rtern nicht \u00fcbereinstimmen. +ERROR_LOGIN_USER_CHANGE_EMAIL_ADDRESS_DISABLED=Das \u00c4ndern der Email-Adresse ist administrativ deaktiviert worden. +ERROR_USER_CHANGE_EMAIL_ADDRESS_ALREADY_QUEUED=Die von Ihnen eingegebene Email-Adresse hatten Sie bereits zum \u00c4ndern eingegeben. Bitte melden Sie sich beim Support. +ERROR_USER_EMAIL_ADDRESSES_MISMATCH=Die von Ihnen eingegebenen Email-Adressen stimmen nicht \u00fcberein. diff --git a/web/WEB-INF/faces-config.xml b/web/WEB-INF/faces-config.xml index e01217a2..825dfcc4 100644 --- a/web/WEB-INF/faces-config.xml +++ b/web/WEB-INF/faces-config.xml @@ -137,7 +137,7 @@ /user/login_index.xhtml user_change_password - /user/login_change_password + /user/login_change_password.xhtml diff --git a/web/WEB-INF/templates/login/user/user_menu.tpl b/web/WEB-INF/templates/login/user/user_menu.tpl index 0bb7007a..cf4958f4 100644 --- a/web/WEB-INF/templates/login/user/user_menu.tpl +++ b/web/WEB-INF/templates/login/user/user_menu.tpl @@ -27,7 +27,7 @@ - + diff --git a/web/WEB-INF/web.xml b/web/WEB-INF/web.xml index 2a3053a1..fd961717 100644 --- a/web/WEB-INF/web.xml +++ b/web/WEB-INF/web.xml @@ -3,6 +3,7 @@ An application for handling and sending out applications to companies. JJobs v1.0 + Project stage. javax.faces.PROJECT_STAGE Development @@ -121,6 +122,11 @@ is_debug_register_enabled false + + Whether users can change their email address. + is_feature_user_must_change_email_address_enabled + true + Faces Servlet javax.faces.webapp.FacesServlet diff --git a/web/user/login_change_email_address.xhtml b/web/user/login_change_email_address.xhtml index 2e17a3a8..7db906ed 100644 --- a/web/user/login_change_email_address.xhtml +++ b/web/user/login_change_email_address.xhtml @@ -17,12 +17,12 @@ - +
- +
@@ -54,19 +54,15 @@ - + - + - - - - - - + + diff --git a/web/user/login_change_password.xhtml b/web/user/login_change_password.xhtml index fd798350..cb4b87ac 100644 --- a/web/user/login_change_password.xhtml +++ b/web/user/login_change_password.xhtml @@ -17,6 +17,12 @@ + + + + + +
@@ -32,23 +38,7 @@
- -
- -
- -
- -
- - - - -
- -
-
- +
@@ -64,7 +54,7 @@
- +
@@ -72,11 +62,11 @@
- - - -
+ + + +
diff --git a/web/user/login_edit_user_data.xhtml b/web/user/login_edit_user_data.xhtml index 29cf9fd4..b634e6ea 100644 --- a/web/user/login_edit_user_data.xhtml +++ b/web/user/login_edit_user_data.xhtml @@ -34,7 +34,7 @@
- +