From 1ba5da9f3e90675e8964f090228405e4f43932f1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 29 Aug 2016 15:05:01 +0200 Subject: [PATCH] Please cherry-pick: - if other user name than current (but maybe other passphrase) one is entered, only then check for it's existence - this avoids double-registering by administrator - set user name in administrative controller, too MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder Signed-off-by: Roland Häder --- .../jjobs/beans/helper/JobsWebViewHelperBean.java | 8 ++++++++ .../jjobs/beans/user/JobsAdminUserWebRequestBean.java | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/java/org/mxchange/jjobs/beans/helper/JobsWebViewHelperBean.java b/src/java/org/mxchange/jjobs/beans/helper/JobsWebViewHelperBean.java index dcc1a4f7..3d4fbd70 100644 --- a/src/java/org/mxchange/jjobs/beans/helper/JobsWebViewHelperBean.java +++ b/src/java/org/mxchange/jjobs/beans/helper/JobsWebViewHelperBean.java @@ -24,6 +24,7 @@ import org.mxchange.jcontacts.contact.Contact; import org.mxchange.jjobs.beans.BaseJobsController; import org.mxchange.jjobs.beans.contact.JobsAdminContactWebRequestController; import org.mxchange.jjobs.beans.phone.JobsAdminPhoneWebRequestController; +import org.mxchange.jjobs.beans.user.JobsAdminUserWebRequestController; import org.mxchange.jjobs.beans.user.JobsUserWebSessionController; import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; @@ -61,6 +62,12 @@ public class JobsWebViewHelperBean extends BaseJobsController implements JobsWeb @Inject private JobsAdminPhoneWebRequestController adminPhoneController; + /** + * Administrative user controller + */ + @Inject + private JobsAdminUserWebRequestController adminUserController; + /** * Contact instance */ @@ -268,6 +275,7 @@ public class JobsWebViewHelperBean extends BaseJobsController implements JobsWeb // Set all fields: user this.userController.setUserName(this.getUser().getUserName()); + this.adminUserController.setUserName(this.getUser().getUserName()); } @Override diff --git a/src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebRequestBean.java index 0bcf903e..1776e0e5 100644 --- a/src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebRequestBean.java @@ -419,7 +419,7 @@ public class JobsAdminUserWebRequestBean extends BaseJobsController implements J // Throw exception throw new FaceletException("Not same password entered"); //NOI18N - } else if (this.userBean.ifUserNameExists(this.getUserName())) { + } else if ((!Objects.equals(user.getUserName(), this.getUserName())) && (this.userBean.ifUserNameExists(this.getUserName()))) { // User name already exists throw new FaceletException(new UserNameAlreadyRegisteredException(this.getUserName())); } else if (this.isSamePasswordEntered()) { -- 2.39.5