]> git.mxchange.org Git - jjobs-war.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Mon, 29 Aug 2016 13:28:12 +0000 (15:28 +0200)
committerRoland Haeder <roland@mxchange.org>
Mon, 29 Aug 2016 17:32:09 +0000 (19:32 +0200)
- rewrote exceptions to nice faces messages
- added missing 18n strings

src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebRequestBean.java
src/java/org/mxchange/localization/bundle_de_DE.properties
src/java/org/mxchange/localization/bundle_en_US.properties

index 1776e0e50a5d28add8bdad1de36bbd61d080ff3e..385502439aca34ee435628e56f6d03dbc1ce7052 100644 (file)
@@ -413,20 +413,30 @@ public class JobsAdminUserWebRequestBean extends BaseJobsController implements J
                        // Not all required fields are set
                        throw new IllegalArgumentException("this.userName is empty"); //NOI18N
                } else if (((!this.getUserPassword().isEmpty()) || (!this.getUserPasswordRepeat().isEmpty())) && (!this.isSamePasswordEntered())) {
-                       // Not same password entered
+                       // Clear password fields
                        this.setUserPassword(null);
                        this.setUserPasswordRepeat(null);
 
-                       // Throw exception
-                       throw new FaceletException("Not same password entered"); //NOI18N
+                       // Not same password entered
+                       this.showFacesMessage("form_edit_user:userPassword", "ADMIN_USER_PASSWORD_REPEAT_DIFFERENT"); //NOI18N
+                       return ""; //NOI18N
                } else if ((!Objects.equals(user.getUserName(), this.getUserName())) && (this.userBean.ifUserNameExists(this.getUserName()))) {
+                       // Clear all fields
+                       this.clear();
+
                        // User name already exists
-                       throw new FaceletException(new UserNameAlreadyRegisteredException(this.getUserName()));
+                       this.showFacesMessage("form_edit_user:userName", "ADMIN_USER_NAME_ALREADY_EXISTS"); //NOI18N
+                       return ""; //NOI18N
                } else if (this.isSamePasswordEntered()) {
                        // Same password entered, create container
-                       if (UserUtils.ifPasswordMatches(new UserLoginContainer(user, this.getUserPassword()))) {
+                       if ((Objects.equals(user.getUserMustChangePassword(), this.getUserMustChangePassword())) && (UserUtils.ifPasswordMatches(new UserLoginContainer(user, this.getUserPassword())))) {
+                               // Clear password fields
+                               this.setUserPassword(null);
+                               this.setUserPasswordRepeat(null);
+
                                // Same password entered
-                               throw new FaceletException("Same password as stored entered."); //NOI18N
+                               this.showFacesMessage("form_edit_user:userPassword", "ADMIN_USER_ENTERED_SAME_AS_OLD_PASSWORD"); //NOI18N
+                               return ""; //NOI18N
                        }
 
                        // Encrypt password
index 09f78d14c435cf39dd6037d57e93758fd2053e75..726aaa6941b4cc22001b57376dcc2265e17f2d33 100644 (file)
@@ -776,3 +776,6 @@ ADMIN_DELETE_USER_NOTICE=Durch das L\u00f6schen des Benutzeraccounts werden nur
 ADMIN_ACTIVITY_ADMIN_DELETED_USER_ACCOUNT=Benutzeraccount gel\u00f6scht vom Administrator.
 USER_ACTIVITY_ADMIN_DELETED_USER_ACCOUNT=Ihr Benutzeraccount wurde von einem Administrator gel\u00f6scht.
 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)
index 98308e246b523ded9ccb7fe5939346351208ee00..4987f4868d7be93879d3f2f6c87ad45c466a4d3b 100644 (file)
@@ -777,3 +777,6 @@ ADMIN_DELETE_USER_NOTICE=By deleting the user's account, only user data is delet
 ADMIN_ACTIVITY_ADMIN_DELETED_USER_ACCOUNT=User account has been deleted by administrator.
 USER_ACTIVITY_ADMIN_DELETED_USER_ACCOUNT=Your account has been deleted by an administrator.
 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).