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;
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;
@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
*/
@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
*/
}
@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
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