]> git.mxchange.org Git - jjobs-war.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Tue, 30 Aug 2016 11:01:27 +0000 (13:01 +0200)
committerRoland Haeder <roland@mxchange.org>
Wed, 31 Aug 2016 19:57:07 +0000 (21:57 +0200)
- removed redundant test on current password matching + output nice faces message

src/java/org/mxchange/jjobs/beans/user/password/JobsUserPasswordWebRequestBean.java

index 61b31771a4e3ed74f7831f5bab2f081a3beca25c..a23f60b8cf4a0ed534c527fc614ce5150ab3b070 100644 (file)
@@ -33,7 +33,6 @@ import org.mxchange.jjobs.beans.login.JobsUserLoginWebSessionController;
 import org.mxchange.jusercore.events.user.password_change.UpdatedUserPasswordEvent;
 import org.mxchange.jusercore.events.user.password_change.UserUpdatedPasswordEvent;
 import org.mxchange.jusercore.exceptions.UserNotFoundException;
-import org.mxchange.jusercore.exceptions.UserPasswordMismatchException;
 import org.mxchange.jusercore.exceptions.UserStatusLockedException;
 import org.mxchange.jusercore.exceptions.UserStatusUnconfirmedException;
 import org.mxchange.jusercore.model.user.User;
@@ -116,12 +115,6 @@ public class JobsUserPasswordWebRequestBean extends BaseJobsController implement
                        // Not all required fields are set
                        throw new FaceletException("Not all required fields are set."); //NOI18N
                } else if (!this.userLoginController.ifCurrentPasswordMatches()) {
-                       // Password not matching
-                       throw new FaceletException(new UserPasswordMismatchException(this.userLoginController.getLoggedInUser()));
-               } else if (!this.featureController.isFeatureEnabled("change_user_password")) { //NOI18N
-                       // Editing is not allowed
-                       throw new IllegalStateException("User tried to change password."); //NOI18N
-               } else if (!UserUtils.ifPasswordMatches(this.userLoginController.getUserCurrentPassword(), this.userLoginController.getLoggedInUser())) {
                        // Password mismatches
                        this.showFacesMessage("form_user_change_password:userCurrentPassword", "ERROR_USER_CURRENT_PASSWORD_MISMATCHING"); //NOI18N
 
@@ -131,6 +124,9 @@ public class JobsUserPasswordWebRequestBean extends BaseJobsController implement
 
                        // No redirect
                        return ""; //NOI18N
+               } else if (!this.featureController.isFeatureEnabled("change_user_password")) { //NOI18N
+                       // Editing is not allowed
+                       throw new IllegalStateException("User tried to change password."); //NOI18N
                } else if (!Objects.equals(this.getUserPassword(), this.getUserPasswordRepeat())) {
                        // Both entered passwords don't match
                        this.showFacesMessage("form_user_change_password:userPasswordRepeat", "ERROR_USER_NEW_PASSWORDS_MISMATCH"); //NOI18N