]> git.mxchange.org Git - addressbook-war.git/commitdiff
fixed template "base path" (please cherry-pick this)
authorRoland Häder <roland@mxchange.org>
Thu, 16 Jun 2016 14:04:49 +0000 (16:04 +0200)
committerRoland Haeder <roland@mxchange.org>
Thu, 28 Jul 2016 19:47:47 +0000 (21:47 +0200)
Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/addressbook/beans/login/AddressbookUserLoginWebSessionBean.java

index e4837c424fb04247060bfff39cddfa9534cf2da1..8a6b8e195058df08c3fba77f3a95e22c1d1940ca 100644 (file)
@@ -20,7 +20,6 @@ import java.util.Objects;
 import javax.enterprise.context.SessionScoped;
 import javax.enterprise.event.Event;
 import javax.enterprise.inject.Any;
-import javax.faces.context.FacesContext;
 import javax.faces.view.facelets.FaceletException;
 import javax.inject.Inject;
 import javax.inject.Named;
@@ -34,7 +33,6 @@ 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.logout.UserLogoutEvent;
 import org.mxchange.jusercore.exceptions.UserNotFoundException;
 import org.mxchange.jusercore.exceptions.UserPasswordMismatchException;
 import org.mxchange.jusercore.exceptions.UserStatusLockedException;
@@ -54,11 +52,27 @@ import org.mxchange.jusercore.model.user.status.UserAccountStatus;
 @SessionScoped
 public class AddressbookUserLoginWebSessionBean extends BaseAddressbookController implements AddressbookUserLoginWebSessionController {
 
+       /**
+        * Path name for guest base template
+        */
+       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";
+
        /**
         * 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
         */
@@ -81,12 +95,6 @@ public class AddressbookUserLoginWebSessionBean extends BaseAddressbookControlle
        @Any
        private Event<UserLoggedInEvent> loginEvent;
 
-       /**
-        * Template type for pages that might be displayed in guest area and login
-        * area. Default is guest area.
-        */
-       private String templateType = "guest"; //NOI18N
-
        /**
         * User controller
         */
@@ -161,23 +169,13 @@ public class AddressbookUserLoginWebSessionBean extends BaseAddressbookControlle
        }
 
        @Override
-       public void setBaseTemplatePathName (final String baseTemplatePathName) {
-               this.baseTemplatePathName = baseTemplatePathName;
+       public String getBaseTemplatePathName () {
+               return this.baseTemplatePathName;
        }
 
        @Override
-       public String doUserLogout () {
-               // Fire event
-               this.userLogoutEvent.fire(new UserLogoutEvent(this.getLoggedInUser()));
-
-               // Invalidate session
-               FacesContext.getCurrentInstance().getExternalContext().invalidateSession();
-
-               // Unset any user instances
-               this.setLoggedInUser(null);
-
-               // Redirect to index
-               return "index?faces-redirect=true"; //NOI18N
+       public void setBaseTemplatePathName (final String baseTemplatePathName) {
+               this.baseTemplatePathName = baseTemplatePathName;
        }
 
        @Override
@@ -200,16 +198,6 @@ public class AddressbookUserLoginWebSessionBean extends BaseAddressbookControlle
                this.loggedInUser = loggedInUser;
        }
 
-       @Override
-       public String getTemplateType () {
-               return this.templateType;
-       }
-
-       @Override
-       public void setTemplateType (final String templateType) {
-               this.templateType = templateType;
-       }
-
        @Override
        public boolean ifCurrentPasswordMatches () {
                // The current password must be set and not empty