]> git.mxchange.org Git - addressbook-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>
Sat, 6 Aug 2016 21:31:16 +0000 (23:31 +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/addressbook/beans/user/AddressbookAdminUserWebRequestBean.java
src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebRequestController.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 d389b29c70515dfd51d26e92084a92d817deacfb..4b12a3a2f0f7d0121470755a962b9550baccf589 100644 (file)
@@ -18,7 +18,6 @@ package org.mxchange.addressbook.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;
@@ -110,6 +109,11 @@ public class AddressbookAdminUserWebRequestBean extends BaseAddressbookControlle
        @Any
        private Event<AdminLinkedUserEvent> userLinkedEvent;
 
+       /**
+        * User lock reason
+        */
+       private String userLockReason;
+
        /**
         * Flag whether user must change password after login
         */
@@ -371,6 +375,16 @@ public class AddressbookAdminUserWebRequestBean extends BaseAddressbookControlle
                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;
@@ -411,13 +425,6 @@ public class AddressbookAdminUserWebRequestBean extends BaseAddressbookControlle
                this.userPasswordRepeat = userPasswordRepeat;
        }
 
-       /**
-        * Post-initialization of this class
-        */
-       @PostConstruct
-       public void init () {
-       }
-
        /**
         * Clears this bean
         */
index e9bace4e1182a9c75b0c8e5bfbd82c61330f3bb0..7c4526573fa0c5ed4a4e34b024fd498c317a6976 100644 (file)
@@ -105,4 +105,18 @@ public interface AddressbookAdminUserWebRequestController 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 954f28265ac5d51c3285f90d34de6cf8cc1be499..195e50b6f6d1a90886bcf58560ded3c24e8ff09f 100644 (file)
@@ -621,3 +621,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 80a200e3b5ce1ed65d14d5d388bf61b6d009563e..9f6eb8ee4af932c2b14a0678ecbdb8761f175dc9 100644 (file)
@@ -618,3 +618,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>