From: Roland Häder Date: Thu, 16 Jun 2016 14:04:49 +0000 (+0200) Subject: fixed template "base path" (please cherry-pick this) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=dd956ec01a82c354d6017f5ef3eb809831b7b637;p=addressbook-war.git fixed template "base path" (please cherry-pick this) Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/addressbook/beans/login/AddressbookUserLoginWebSessionBean.java b/src/java/org/mxchange/addressbook/beans/login/AddressbookUserLoginWebSessionBean.java index e4837c42..8a6b8e19 100644 --- a/src/java/org/mxchange/addressbook/beans/login/AddressbookUserLoginWebSessionBean.java +++ b/src/java/org/mxchange/addressbook/beans/login/AddressbookUserLoginWebSessionBean.java @@ -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 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