From: Roland Häder Date: Tue, 30 Aug 2016 11:01:27 +0000 (+0200) Subject: Please cherry-pick: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ab77b564588e45a8ad0723e822f3f018a68f54bf;p=jjobs-war.git Please cherry-pick: - removed redundant test on current password matching + output nice faces message --- diff --git a/src/java/org/mxchange/jjobs/beans/user/password/JobsUserPasswordWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/user/password/JobsUserPasswordWebRequestBean.java index 61b31771..a23f60b8 100644 --- a/src/java/org/mxchange/jjobs/beans/user/password/JobsUserPasswordWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/user/password/JobsUserPasswordWebRequestBean.java @@ -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