]> git.mxchange.org Git - jjobs-war.git/commitdiff
Continued with user locking: (please cherry-pick)
authorRoland Häder <roland@mxchange.org>
Thu, 4 Aug 2016 16:10:38 +0000 (18:10 +0200)
committerRoland Haeder <roland@mxchange.org>
Sun, 7 Aug 2016 10:25:44 +0000 (12:25 +0200)
- added form for un-/locking users
  + it shows buttons depending on if the user is lock/unlocked or unconfirmed
  + if the user is unconfirmed, a text is shown (maybe not wanted, easy to rewrite to a "feature")
  + if the user is locked, the reason is shown
- added lock reason to controller (bean)
- added missing 18n strings

src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebRequestBean.java
src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebRequestController.java
src/java/org/mxchange/localization/bundle_de_DE.properties
src/java/org/mxchange/localization/bundle_en_US.properties
web/admin/user/admin_user_unlock.xhtml

index c42f3f238ebaf0619dbf5f8fb467df1f56c05b56..8143692446a92aff078f647073ed0f138b39f86f 100644 (file)
@@ -18,7 +18,6 @@ package org.mxchange.jjobs.beans.user;
 
 import java.text.MessageFormat;
 import java.util.Objects;
-import javax.annotation.PostConstruct;
 import javax.enterprise.context.RequestScoped;
 import javax.enterprise.event.Event;
 import javax.enterprise.event.Observes;
@@ -101,6 +100,11 @@ public class JobsAdminUserWebRequestBean extends BaseJobsController implements J
        @Inject
        private JobsUserWebSessionController userController;
 
+       /**
+        * User lock reason
+        */
+       private String userLockReason;
+
        /**
         * Flag whether user must change password after login
         */
@@ -362,6 +366,16 @@ public class JobsAdminUserWebRequestBean extends BaseJobsController implements J
                return "admin_list_user"; //NOI18N
        }
 
+       @Override
+       public String getUserLockReason () {
+               return this.userLockReason;
+       }
+
+       @Override
+       public void setUserLockReason (final String userLockReason) {
+               this.userLockReason = userLockReason;
+       }
+
        @Override
        public Boolean getUserMustChangePassword () {
                return this.userMustChangePassword;
@@ -402,13 +416,6 @@ public class JobsAdminUserWebRequestBean extends BaseJobsController implements J
                this.userPasswordRepeat = userPasswordRepeat;
        }
 
-       /**
-        * Post-initialization of this class
-        */
-       @PostConstruct
-       public void init () {
-       }
-
        /**
         * Clears this bean
         */
index 3b3195d9c996eb8bf604fd93698bd8b6e8e604b0..764e09dba4b8da0d128ded1d13c24a449158d010 100644 (file)
@@ -105,4 +105,18 @@ public interface JobsAdminUserWebRequestController extends Serializable {
         */
        void setUserMustChangePassword (final Boolean userMustChangePassword);
 
+       /**
+        * Getter for user lock reason
+        * <p>
+        * @return User lock reason
+        */
+       String getUserLockReason ();
+
+       /**
+        * Setter for user lock reason
+        * <p>
+        * @param userLockReason User lock reason
+        */
+       void setUserLockReason (final String userLockReason);
+
 }
index ccc4ae6bddb992eb25084127c3396dd0145cf0af..0f324bf2aa32317d71406cf4c60f842c2ba2cc57 100644 (file)
@@ -588,3 +588,5 @@ USER_CURRENT_PASSWORD_REQUIRED=Bitte geben Sie Ihr derzeit verwendetes Passwort
 USER_NEW_PASSWORD_REQUIRED=Bitte geben Sie ein neues Passwort zweimal ein. Dieses muss anders als Ihr aktuelles sein.
 USER_NEW_PASSWORD_REPEAT_REQUIRED=Bitte wiederholen Sie das neue Passwort. Dies dient der Reduzierung von Tippfehlern.
 ADMIN_USER_MUST_CHANGE_PASSWORD=Soll der Benutzer sein Kennwort nach dem Einloggen selber \u00e4ndern?
+ERROR_CANNOT_UN_LOCK_USER_ACCOUNT_UNCONFIRMED=Fehler: Kann das Benutzerkonto nicht sperren oder entsperren, da es noch nicht best\u00e4tigt ist.
+ADMIN_USER_UNLOCK_REASON_REQUIRED=Bitte geben Sie einen aussagekr\u00e4ftigen Grund f\u00fcr die Account-Sperre ein.
index 2576df3b7569d76b598531a05c49ec4238ff3006..608922245a754c92fcce4aab6e253199ed0b4e62 100644 (file)
@@ -588,3 +588,5 @@ USER_CURRENT_PASSWORD_REQUIRED=Please enter your currently used password for con
 USER_NEW_PASSWORD_REQUIRED=Please a new password twice. This must be different than the current one.
 USER_NEW_PASSWORD_REPEAT_REQUIRED=Please repeat your new password. This is for preventing type mistakes.
 ADMIN_USER_MUST_CHANGE_PASSWORD=Should the user change his password after login?
+ERROR_CANNOT_UN_LOCK_USER_ACCOUNT_UNCONFIRMED=Error: Cannot lock or unlock user account, it is still unconfirmed.
+ADMIN_USER_UNLOCK_REASON_REQUIRED=Please provide a good reason why you want to lock this user's account.
index 2e00380a255a0163b15e2280bcabd908c1c39611..06f86a245d5f6ae911c0de136f9405d0e329527b 100644 (file)
                <ui:define name="content">
                        <h:outputText styleClass="errors" value="#{msg.ERROR_USER_ID_NOT_FOUND}" rendered="#{empty beanHelper.user}" />
 
-                       <h:form id="form_admin_user_unlock">
-                               
+                       <h:form id="form_admin_user_unlock" rendered="#{not empty beanHelper.user}">
+                               <div class="table">
+                                       <div class="table_header">
+                                               <h:outputFormat value="#{msg.ADMIN_UNLOCK_USER_TITLE}">
+                                                       <f:param value="#{beanHelper.user.userId}" />
+                                                       <f:param value="#{beanHelper.user.userName}" />
+                                               </h:outputFormat>
+                                       </div>
+
+                                       <div class="table_row">
+                                               <div class="table_left25">
+                                                       <h:outputLabel for="contactGender" value="#{msg.PERSONAL_DATA_GENDER}" />
+                                               </div>
+
+                                               <div class="table_right75">
+                                                       <h:outputText id="contactGender" value="#{msg[beanHelper.user.userContact.contactGender.messageKey]}" />
+                                               </div>
+                                       </div>
+
+                                       <div class="table_row">
+                                               <div class="table_left25">
+                                                       <h:outputLabel for="contactFirstName" value="#{msg.PERSONAL_DATA_FIRST_NAME}" />
+                                               </div>
+
+                                               <div class="table_right75">
+                                                       <h:outputText id="contactFirstName" value="#{beanHelper.user.userContact.contactFirstName}" />
+                                               </div>
+                                       </div>
+
+                                       <div class="table_row">
+                                               <div class="table_left25">
+                                                       <h:outputLabel for="contactFamilyName" value="#{msg.PERSONAL_DATA_FAMILY_NAME}" />
+                                               </div>
+
+                                               <div class="table_right75">
+                                                       <h:outputText id="contactFamilyName" value="#{beanHelper.user.userContact.contactFamilyName}" />
+                                               </div>
+                                       </div>
+
+                                       <div class="table_row">
+                                               <div class="table_left25">
+                                                       <h:outputLabel for="userLockReason" value="#{msg.ADMIN_ENTER_USER_LOCK_REASON}" />
+                                               </div>
+
+                                               <div class="table_right75">
+                                                       <h:inputTextarea id="userLockReason" value="#{adminUserController.userLockReason}" cols="30" rows="20" required="true" requiredMessage="#{msg.ADMIN_USER_UNLOCK_REASON_REQUIRED}" />
+
+                                                       <h:outputText value="#{adminUserController.userLockReason}" />
+
+                                                       <h:outputText value="#{msg.ERROR_CANNOT_UN_LOCK_USER_ACCOUNT_UNCONFIRMED}" rendered="#{beanHelper.user.userAccountStatus == UserAccountStatus.UNCONFIRMED}" />
+                                               </div>
+                                       </div>
+
+                                       <div class="table_footer">
+                                               <h:commandButton styleClass="reset" type="reset" value="#{msg.BUTTON_RESET_FORM}" />
+
+                                               <h:commandButton styleClass="submit" type="submit" action="#{adminUserController.lockUserAccount()}" value="#{msg.BUTTON_ADMIN_LOCK_USER_ACCOUNT}" rendered="#{beanHelper.user.userAccountStatus == UserAccountStatus.CONFIRMED}" />
+
+                                               <h:commandButton styleClass="submit" type="submit" action="#{adminUserController.unlockUserAccount()}" value="#{msg.BUTTON_ADMIN_UNLOCK_USER_ACCOUNT}" rendered="#{beanHelper.user.userAccountStatus == UserAccountStatus.LOCKED}" />
+
+                                               <h:outputText value="#{msg.ERROR_CANNOT_UN_LOCK_USER_ACCOUNT_UNCONFIRMED}" rendered="#{beanHelper.user.userAccountStatus == UserAccountStatus.UNCONFIRMED}" />
+                                       </div>
+                               </div>
                        </h:form>
                </ui:define>
        </ui:composition>