]> git.mxchange.org Git - jjobs-war.git/commitdiff
Rewrites: (please cherry-pick also)
authorRoland Häder <roland@mxchange.org>
Fri, 10 Jun 2016 12:55:14 +0000 (14:55 +0200)
committerRoland Haeder <roland@mxchange.org>
Sun, 7 Aug 2016 12:08:20 +0000 (14:08 +0200)
- rewrote templateType to baseTemplatePathName which allows more "complex" paths than just simple
- imprint, terms and privacy can now make usage of that new variable and don't need to be shown in new browser window

Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/jjobs/beans/login/JobsUserLoginWebSessionBean.java
src/java/org/mxchange/jjobs/beans/login/JobsUserLoginWebSessionController.java
web/WEB-INF/templates.dist/guest_login_page.xhtml
web/WEB-INF/templates/login/user/user_footer.tpl
web/guest/user/user_list.xhtml
web/guest/user/user_profile.xhtml
web/imprint.xhtml
web/privacy.xhtml
web/terms.xhtml

index 899d64f986a3b9718c85c3e2d1c7a6c78dd9766b..473f2db5279efad23d1d369970b64e74d2a6b569 100644 (file)
@@ -37,6 +37,7 @@ import org.mxchange.jusercore.container.login.LoginContainer;
 import org.mxchange.jusercore.container.login.UserLoginContainer;
 import org.mxchange.jusercore.events.login.UserLoggedInEvent;
 import org.mxchange.jusercore.events.login.UserLoginEvent;
+import org.mxchange.jusercore.events.logout.ObserveableUserLogoutEvent;
 import org.mxchange.jusercore.events.user.password_change.UpdatedUserPasswordEvent;
 import org.mxchange.jusercore.exceptions.UserNotFoundException;
 import org.mxchange.jusercore.exceptions.UserPasswordMismatchException;
@@ -62,18 +63,24 @@ public class JobsUserLoginWebSessionBean extends BaseJobsController implements J
        /**
         * Path name for guest base template
         */
-       private static final String GUEST_BASE_TEMPLATE_NAME = "guest/guest"; //NOI18N
+       private static final String GUEST_BASE_TEMPLATE_NAME = "guest/guest";
 
        /**
         * Path name for logged-in user base template
         */
-       private static final String USER_BASE_TEMPLATE_NAME = "login/user/user"; //NOI18N
+       private static final String USER_BASE_TEMPLATE_NAME = "login/user/user";
 
        /**
         * Serial number
         */
        private static final long serialVersionUID = 47_828_986_719_691_592L;
 
+       /**
+        * Template type for pages that might be displayed in guest area and login
+        * area.
+        */
+       private String baseTemplatePathName;
+
        /**
         * Current password
         */
@@ -85,28 +92,42 @@ public class JobsUserLoginWebSessionBean extends BaseJobsController implements J
        private User loggedInUser;
 
        /**
-        * User controller
+        * Remote register session bean
         */
-       @Inject
-       private JobsUserWebSessionController userController;
+       private UserLoginSessionBeanRemote loginBean;
 
        /**
-        * Event being fired when user logs in
+        * Event fired when user has logged in
         */
        @Inject
        @Any
        private Event<UserLoggedInEvent> loginEvent;
 
        /**
-        * EJB for user-login
+        * User controller
         */
-       private UserLoginSessionBeanRemote userLoginBean;
+       @Inject
+       private JobsUserWebSessionController userController;
 
        /**
         * Flag whether the user has logged-in, set only from inside
         */
        private boolean userLoggedIn;
 
+       /**
+        * Event fired when user has logged in
+        */
+       @Inject
+       @Any
+       private Event<UserLoggedInEvent> userLoginEvent;
+
+       /**
+        * Event fired when user has logged out
+        */
+       @Inject
+       @Any
+       private Event<ObserveableUserLogoutEvent> userLogoutEvent;
+
        /**
         * User's password history
         */
@@ -126,7 +147,7 @@ public class JobsUserLoginWebSessionBean extends BaseJobsController implements J
                        Context context = new InitialContext();
 
                        // Try to lookup
-                       this.userLoginBean = (UserLoginSessionBeanRemote) context.lookup("java:global/jjobs-ejb/login!org.mxchange.jusercore.model.login.UserLoginSessionBeanRemote"); //NOI18N
+                       this.loginBean = (UserLoginSessionBeanRemote) context.lookup("java:global/addressbook-ejb/login!org.mxchange.jusercore.model.login.UserLoginSessionBeanRemote"); //NOI18N
 
                        // Also find this
                        this.userPasswordHistoryBean = (UserPasswordHistorySessionBeanRemote) context.lookup(""); //NOI18N
@@ -188,7 +209,7 @@ public class JobsUserLoginWebSessionBean extends BaseJobsController implements J
 
                try {
                        // Call bean
-                       User confirmedUser = this.userLoginBean.validateUserAccountStatus(container);
+                       User confirmedUser = this.loginBean.validateUserAccountStatus(container);
 
                        // All fine here so set it here
                        this.setLoggedInUser(confirmedUser);
@@ -197,10 +218,13 @@ public class JobsUserLoginWebSessionBean extends BaseJobsController implements J
                        this.userPasswordHistory = this.userPasswordHistoryBean.getUserPasswordHistory(confirmedUser);
 
                        // Set template to "login"
-                       this.setTemplateType("login"); //NOI18N
+                       this.setBaseTemplatePathName(USER_BASE_TEMPLATE_NAME); //NOI18N
 
                        // Fire event away. Keep this last before return statement.
-                       this.loginEvent.fire(new UserLoginEvent(confirmedUser));
+                       this.userLoginEvent.fire(new UserLoginEvent(confirmedUser));
+
+                       // Clear this bean
+                       this.clear();
 
                        // All fine
                        return "login"; //NOI18N
@@ -215,6 +239,16 @@ public class JobsUserLoginWebSessionBean extends BaseJobsController implements J
                }
        }
 
+       @Override
+       public String getBaseTemplatePathName () {
+               return this.baseTemplatePathName;
+       }
+
+       @Override
+       public void setBaseTemplatePathName (final String baseTemplatePathName) {
+               this.baseTemplatePathName = baseTemplatePathName;
+       }
+
        @Override
        public String getCurrentPassword () {
                return this.currentPassword;
@@ -306,15 +340,9 @@ public class JobsUserLoginWebSessionBean extends BaseJobsController implements J
 
        @Override
        public boolean isUserLoggedIn () {
-               // Trace message
-               // NOISY-DEBUG System.out.println(MessageFormat.format("JobsUserLoginWebSessionBean:isUserLoggedIn: this.loggedInUser={0},this.templateType={1} - CALLED!", this.getLoggedInUser(), this.getTemplateType()));
-
                // Compare instance
                this.userLoggedIn = ((this.getLoggedInUser() instanceof User) && (Objects.equals(this.getLoggedInUser().getUserAccountStatus(), UserAccountStatus.CONFIRMED)));
 
-               // Trace message
-               // NOISY-DEBUG System.out.println(MessageFormat.format("JobsUserLoginWebSessionBean:isUserLoggedIn: this.userLoggedIn={0} - EXIT!", this.userLoggedIn));
-
                // Return it
                return this.userLoggedIn;
        }
index 3a131e88783849a72df549da46452d8beb6d62fc..597a1738e9c2146994b2276926d3d801805aad6b 100644 (file)
@@ -49,18 +49,18 @@ public interface JobsUserLoginWebSessionController extends Serializable {
        boolean isPasswordInHistory (final String userPassword);
 
        /**
-        * Getter for template type
+        * Getter for base template type
         * <p>
         * @return Template type
         */
-       String getTemplateType ();
+       String getBaseTemplatePathName ();
 
        /**
-        * Setter for template type
+        * Setter for base template type
         * <p>
-        * @param templateType Template type
+        * @param baseTemplatePathName Template type
         */
-       void setTemplateType (final String templateType);
+       void setBaseTemplatePathName (final String baseTemplatePathName);
 
        /**
         * Logout for administrator area. If a logged-in user instance exists, it is
index f014ab4e6e0dca828f07cd9c209c17f1c492c33d..eb4dd3280e9a17489b8d1a1f64701ccbad24669e 100644 (file)
@@ -2,12 +2,12 @@
 <html
        lang="#{localizationController.language}" xml:lang="#{localizationController.language}"
        xmlns="http://www.w3.org/1999/xhtml"
-         xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
-         xmlns:h="http://xmlns.jcp.org/jsf/html"
-         xmlns:f="http://xmlns.jcp.org/jsf/core"
-         >
+       xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
+       xmlns:h="http://xmlns.jcp.org/jsf/html"
+       xmlns:f="http://xmlns.jcp.org/jsf/core"
+       >
 
-       <ui:composition template="/WEB-INF/templates/#{userLoginController.templateType}/#{userLoginController.templateType}_base.tpl">
+       <ui:composition template="/WEB-INF/templates/#{userLoginController.baseTemplatePathName}_base.tpl">
                <ui:define name="guest_title">#{msg.PAGE_TITLE_INDEX_FOO}</ui:define>
 
                <ui:define name="content_header">
index bafe6e1bcdd62a1a5da388250ba88e3e8a9693e8..73d6d5e72cecdec96ba2a420f18a05b69068316b 100644 (file)
                                <h:link outcome="login_index" title="#{msg.LINK_LOGIN_HOME_TITLE}" value="#{msg.LINK_LOGIN_HOME}" />
                        </li>
 
-                       <li class="footer_link">
-                               <h:link outcome="imprint" title="#{msg.LINK_GUEST_IMPRINT_TITLE}" value="#{msg.LINK_GUEST_IMPRINT}" />
-                       </li>
+                       <ui:fragment rendered="#{featureController.isFeatureEnabled('imprint')}">
+                               <li class="footer_link">
+                                       <h:link outcome="imprint" title="#{msg.LINK_GUEST_IMPRINT_TITLE}" value="#{msg.LINK_GUEST_IMPRINT}" />
+                               </li>
+                       </ui:fragment>
 
-                       <li class="footer_link">
-                               <h:link outcome="terms" title="#{msg.LINK_GUEST_TERMS_TITLE}" value="#{msg.LINK_GUEST_TERMS}" />
-                       </li>
+                       <ui:fragment rendered="#{featureController.isFeatureEnabled('terms')}">
+                               <li class="footer_link">
+                                       <h:link outcome="terms" title="#{msg.LINK_GUEST_TERMS_TITLE}" value="#{msg.LINK_GUEST_TERMS}" />
+                               </li>
+                       </ui:fragment>
 
-                       <li class="footer_link">
-                               <h:link outcome="privacy" title="#{msg.LINK_GUEST_PRIVACY_TITLE}" value="#{msg.LINK_GUEST_PRIVACY}" />
-                       </li>
+                       <ui:fragment rendered="#{featureController.isFeatureEnabled('privacy')}">
+                               <li class="footer_link">
+                                       <h:link outcome="privacy" title="#{msg.LINK_GUEST_PRIVACY_TITLE}" value="#{msg.LINK_GUEST_PRIVACY}" />
+                               </li>
+                       </ui:fragment>
 
                        <li class="footer_copyright">Copyright (c) 2016 by Roland Häder</li>
                </ul>
index 18ffc7a2534ba42611e784230477cab702f36b2b..ba5819161505825c39b18cb599a37e77ad096284 100644 (file)
@@ -6,7 +6,7 @@
          xmlns:h="http://xmlns.jcp.org/jsf/html"
          xmlns:f="http://xmlns.jcp.org/jsf/core">
 
-       <ui:composition template="/WEB-INF/templates/#{userLoginController.templateType}/#{userLoginController.templateType}_base.tpl">
+       <ui:composition template="/WEB-INF/templates/#{userLoginController.baseTemplatePathName}_base.tpl">
                <ui:define name="login_title">#{msg.PAGE_TITLE_USER_LIST}</ui:define>
 
                <ui:define name="content_header">
index 89a917f5d50f9d0e2690714aacf676c3d9d58f35..e57c5865056012991d587601545fab2327198fd9 100644 (file)
@@ -13,7 +13,7 @@
                </f:viewParam>
        </f:metadata>
 
-       <ui:composition template="/WEB-INF/templates/#{userLoginController.templateType}/#{userLoginController.templateType}_base.tpl">
+       <ui:composition template="/WEB-INF/templates/#{userLoginController.baseTemplatePathName}_base.tpl">
                <ui:define name="login_title">#{msg.PAGE_TITLE_LOGIN_USER_PROFILE}</ui:define>
                <ui:define name="guest_title">#{msg.PAGE_TITLE_INDEX_USER_PROFILE}</ui:define>
 
index 5b07b596363aaf3f3ac5df3457350f15c406d551..5578d959b6887c86a8223dd782ef07e4e5149f59 100644 (file)
@@ -7,7 +7,7 @@
        xmlns:f="http://xmlns.jcp.org/jsf/core"
        >
 
-       <ui:composition template="/WEB-INF/templates/#{userLoginController.templateType}/#{userLoginController.templateType}_base.tpl">
+       <ui:composition template="/WEB-INF/templates/#{userLoginController.baseTemplatePathName}_base.tpl">
                <ui:define name="guest_title">#{msg.PAGE_TITLE_INDEX_IMPRINT}</ui:define>
 
                <ui:define name="content_header">
index 52ae8127293703cd136d440ab96e139de7df0b69..6cb3893e450f283e5bf1d6c4fa700099c38ea754 100644 (file)
@@ -7,7 +7,7 @@
        xmlns:f="http://xmlns.jcp.org/jsf/core"
        >
 
-       <ui:composition template="/WEB-INF/templates/#{userLoginController.templateType}/#{userLoginController.templateType}_base.tpl">
+       <ui:composition template="/WEB-INF/templates/#{userLoginController.baseTemplatePathName}_base.tpl">
                <ui:define name="guest_title">#{msg.PAGE_TITLE_INDEX_PRIVACY}</ui:define>
 
                <ui:define name="content_header">
index 69708a0f27b9985b310da7ce35c502b2eea814fe..1e7acae567ecec8aa754ac663ca9a24f8c927758 100644 (file)
@@ -7,7 +7,7 @@
        xmlns:f="http://xmlns.jcp.org/jsf/core"
        >
 
-       <ui:composition template="/WEB-INF/templates/#{userLoginController.templateType}/#{userLoginController.templateType}_base.tpl">
+       <ui:composition template="/WEB-INF/templates/#{userLoginController.baseTemplatePathName}_base.tpl">
                <ui:define name="guest_title">#{msg.PAGE_TITLE_INDEX_TERMS}</ui:define>
 
                <ui:define name="content_header">