]> git.mxchange.org Git - pizzaservice-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 19:58:07 +0000 (21:58 +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/localization/bundle_de_DE.properties
src/java/org/mxchange/localization/bundle_en_US.properties
src/java/org/mxchange/pizzaapplication/beans/user/PizzaAdminUserWebRequestBean.java
src/java/org/mxchange/pizzaapplication/beans/user/PizzaAdminUserWebRequestController.java
web/admin/user/admin_user_unlock.xhtml

index 647bfbf62314f3c09706f00861e836d341c0a5ec..313abf1e43c1353f659fe5f0e93ccc3d7e1cab86 100644 (file)
@@ -593,3 +593,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 a972ef33dc7e087d3f253f4c9c2aa641c7a48db6..51eaaacf358eeb83b1426c5a21ac2277ec6f9193 100644 (file)
@@ -576,3 +576,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 48c4bcba5592b61dd700016dce30d3d30dd263bb..d9ad028cd2b0ba6172797d93c8910ecc33fceb53 100644 (file)
@@ -18,7 +18,6 @@ package org.mxchange.pizzaapplication.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 PizzaAdminUserWebRequestBean extends BasePizzaController implements
        @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 PizzaAdminUserWebRequestBean extends BasePizzaController implements
                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 PizzaAdminUserWebRequestBean extends BasePizzaController implements
                this.userPasswordRepeat = userPasswordRepeat;
        }
 
-       /**
-        * Post-initialization of this class
-        */
-       @PostConstruct
-       public void init () {
-       }
-
        /**
         * Clears this bean
         */
index f9c7941657ceb93d4c1ec366e9fb60679adc97b8..d0276b2966144c0cb1754bb2e638adb65c0a7491 100644 (file)
@@ -105,4 +105,18 @@ public interface PizzaAdminUserWebRequestController 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 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>