]> git.mxchange.org Git - jjobs-war.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Mon, 29 Aug 2016 14:17:52 +0000 (16:17 +0200)
committerRoland Haeder <roland@mxchange.org>
Mon, 29 Aug 2016 17:32:59 +0000 (19:32 +0200)
- 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 <roland@haeder.net>
Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/jjobs/beans/email_address/JobsEmailChangeWebSessionBean.java
src/java/org/mxchange/localization/bundle_de_DE.properties
src/java/org/mxchange/localization/bundle_en_US.properties
web/WEB-INF/faces-config.xml
web/WEB-INF/templates/login/user/user_menu.tpl
web/WEB-INF/web.xml
web/user/login_change_email_address.xhtml
web/user/login_change_password.xhtml
web/user/login_edit_user_data.xhtml

index 7fe5248a0776e46cefbb045c80dc197e438e76c6..bf1328c6990d6294e40ca04c2978f7fcdf54de36 100644 (file)
@@ -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
index 726aaa6941b4cc22001b57376dcc2265e17f2d33..9f23d63591d9b9350751b3646852871df5176d7e 100644 (file)
@@ -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.
index 4987f4868d7be93879d3f2f6c87ad45c466a4d3b..542f3c80feb71ac41c68e79d403564fc34ad102c 100644 (file)
@@ -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.
index e01217a23aedf3860ef0aa50b64c1237c70346b8..825dfcc41f1a97c2c378d3fb433e4826ff4a3d35 100644 (file)
                <from-view-id>/user/login_index.xhtml</from-view-id>
                <navigation-case>
                        <from-outcome>user_change_password</from-outcome>
-                       <to-view-id>/user/login_change_password</to-view-id>
+                       <to-view-id>/user/login_change_password.xhtml</to-view-id>
                </navigation-case>
        </navigation-rule>
        <navigation-rule>
index 0bb7007a9f0ef4dfcb073bf739df9eec536d0be6..cf4958f46a81588c231df1b77ebcf0775844d2db 100644 (file)
@@ -27,7 +27,7 @@
                                </ui:fragment>
                        </ul>
 
-                       <ui:fragment rendered="#{featureController.isFeatureEnabled('edit_user_data')}">
+                       <ui:fragment rendered="#{featureController.isFeatureEnabled('edit_user_data') or featureController.isFeatureEnabled('change_user_password') or featureController.isFeatureEnabled('user_change_email_address')}">
                                <div class="menu_header">
                                        <h:outputText value="#{msg.MENU_EDIT_PROFILE_TITLE}" />
                                </div>
index 2a3053a1966af3b2a80d550df8fbacf016d9138e..fd961717835d898bedbb3cd46f2f117f950229f7 100644 (file)
@@ -3,6 +3,7 @@
     <description>An application for handling and sending out applications to companies.</description>
     <display-name>JJobs v1.0</display-name>
     <context-param>
+        <description>Project stage.</description>
         <param-name>javax.faces.PROJECT_STAGE</param-name>
         <param-value>Development</param-value>
     </context-param>
         <param-name>is_debug_register_enabled</param-name>
         <param-value>false</param-value>
     </context-param>
+    <context-param>
+        <description>Whether users can change their email address.</description>
+        <param-name>is_feature_user_must_change_email_address_enabled</param-name>
+        <param-value>true</param-value>
+    </context-param>
     <servlet>
         <servlet-name>Faces Servlet</servlet-name>
         <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
index 2e17a3a84f680c0a09d0fc03629086b6ba9f3b6a..7db906ed913bfba9f01370898952eb5a9f05c52b 100644 (file)
                </ui:define>
 
                <ui:define name="content">
-                       <h:panelGroup styleClass="table" layout="block" rendered="#{userLoginController.isUserLoggedIn() and featureController.isFeatureEnabled('edit_user_data') and (not userLoginController.ifUserMustChangePassword() or not featureController.isFeatureEnabled('user_must_change_password'))}">
+                       <h:panelGroup styleClass="table" layout="block" rendered="#{userLoginController.isUserLoggedIn() and featureController.isFeatureEnabled('user_change_email_address')}">
                                <div class="table_header">
                                        <h:outputText value="#{msg.LOGIN_CHANGE_EMAIL_ADDRESS_TITLE}" />
                                </div>
 
-                               <h:form id="form_login_change_email_address">
+                               <h:form id="form_user_change_email_address">
                                        <div class="para">
                                                <fieldset class="fieldset" id="change_email">
                                                        <legend title="#{msg.LOGIN_CHANGE_EMAIL_LEGEND_TITLE}">
                                </h:form>
                        </h:panelGroup>
 
-                       <ui:fragment rendered="#{not featureController.isFeatureEnabled('edit_user_data')}">
+                       <ui:fragment rendered="#{not featureController.isFeatureEnabled('user_change_email_address')}">
                                <ui:include src="/WEB-INF/templates/generic/message_box.tpl">
-                                       <ui:param name="message" value="#{msg.ERROR_LOGIN_USER_EDIT_DATA_DISABLED}" />
+                                       <ui:param name="message" value="#{msg.ERROR_LOGIN_USER_CHANGE_EMAIL_ADDRESS_DISABLED}" />
                                        <ui:param name="styleClass" value="errors" />
                                </ui:include>
                        </ui:fragment>
 
-                       <ui:fragment rendered="#{userLoginController.ifUserMustChangePassword()}">
-                               <h:link outcome="user_change_password" value="#{msg.USER_LOGIN_MUST_CHANGE_PASSWORD}" />
-                       </ui:fragment>
-
-                       <ui:fragment rendered="#{not loginController.isUserLoggedIn()}">
-                               <ui:include id="login_only" src="/WEB-INF/templates/generic/user_not_logged_in.tpl" />
+                       <ui:fragment rendered="#{not userLoginController.isUserLoggedIn()}">
+                               <ui:include id="login_only" src="/WEB-INF/templates/user/user_not_logged_in.tpl" />
                        </ui:fragment>
                </ui:define>
        </ui:composition>
index fd7983505ce4c537ad96112930aec0cd03dbd226..cb4b87ac276f72693c6a417079c486702f1c5d8b 100644 (file)
                </ui:define>
 
                <ui:define name="content">
+                       <ui:fragment rendered="#{userLoginController.loggedInUser.userMustChangePassword == true}">
+                               <ui:include src="/WEB-INF/templates/generic/message_box.tpl">
+                                       <ui:param name="message" value="#{msg.USER_MUST_CHANGE_PASSWORD_NOTICE}" />
+                               </ui:include>
+                       </ui:fragment>
+
                        <ui:fragment rendered="#{userLoginController.isUserLoggedIn()}">
                                <h:panelGroup styleClass="table" layout="block" rendered="#{featureController.isFeatureEnabled('change_user_password')}">
                                        <div class="table_header">
 
                                                                <div class="table_row">
                                                                        <div class="table_left">
-                                                                               <h:outputLabel for="userCurrentPassword" value="#{msg.GUEST_REGISTRATION_ENTER_CURRENT_PASSWORD}" />
-                                                                       </div>
-
-                                                                       <div class="table_right">
-                                                                               <h:inputSecret styleClass="input" id="userCurrentPassword" size="10" maxlength="255" value="#{userPasswordController.userCurrentPassword}" required="true" requiredMessage="#{msg.USER_CURRENT_PASSWORD_REQUIRED}" />
-                                                                       </div>
-
-                                                                       <div class="clear"></div>
-
-                                                                       <h:panelGroup styleClass="error_container" layout="block">
-                                                                               <h:message for="userCurrentPassword" errorClass="errors" fatalClass="errors" warnClass="errors" />
-                                                                       </h:panelGroup>
-                                                               </div>
-
-                                                               <div class="table_row">
-                                                                       <div class="table_left">
-                                                                               <h:outputLabel for="userPassword" value="#{msg.GUEST_REGISTRATION_ENTER_PASSWORD}" />
+                                                                               <h:outputLabel for="userPassword" value="#{msg.USER_ENTER_PASSWORD}" />
                                                                        </div>
 
                                                                        <div class="table_right">
@@ -64,7 +54,7 @@
 
                                                                <div class="table_row">
                                                                        <div class="table_left">
-                                                                               <h:outputLabel for="userPasswordRepeat" value="#{msg.GUEST_REGISTRATION_ENTER_PASSWORD_REPEAT}" />
+                                                                               <h:outputLabel for="userPasswordRepeat" value="#{msg.USER_ENTER_PASSWORD_REPEAT}" />
                                                                        </div>
 
                                                                        <div class="table_right">
                                                                        </div>
 
                                                                        <div class="clear"></div>
-
-                                                                       <h:panelGroup styleClass="error_container" layout="block">
-                                                                               <h:message for="userCurrentPassword" errorClass="errors" fatalClass="errors" warnClass="errors" />
-                                                                       </h:panelGroup>
                                                                </div>
+
+                                                               <h:panelGroup styleClass="error_container" layout="block">
+                                                                       <h:message for="userCurrentPassword" errorClass="errors" fatalClass="errors" warnClass="errors" />
+                                                               </h:panelGroup>
                                                        </fieldset>
                                                </div>
 
index 29cf9fd42d741b9f2510f1fe939534198ff7a85f..b634e6ea7d3491ec5b4f01ada6af96fea6d5096c 100644 (file)
@@ -34,7 +34,7 @@
                                                        </li>
                                                </ui:fragment>
 
-                                               <ui:fragment rendered="#{featureController.isFeatureEnabled('edit_user_data') and (not userLoginController.ifUserMustChangePassword() or not featureController.isFeatureEnabled('user_must_change_password'))}">
+                                               <ui:fragment rendered="#{featureController.isFeatureEnabled('edit_user_data') and (not userLoginController.ifUserMustChangePassword() or not featureController.isFeatureEnabled('user_must_change_email_address'))}">
                                                        <li>
                                                                <h:link title="#{msg.LINK_LOGIN_CHANGE_EMAIL_ADDRESS_TITLE}" outcome="login_change_email_address" value="#{msg.LINK_LOGIN_CHANGE_EMAIL_ADDRESS}" />
                                                        </li>