From: Roland Häder Date: Wed, 3 Aug 2016 09:03:18 +0000 (+0200) Subject: Continued a bit: (please cherry-pick) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5ba4bc7e98ef65b066ee0985529e78808df85524;p=jjobs-war.git Continued a bit: (please cherry-pick) - added retrival of user's password history for current user (not admin) - added getter in interface Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/jjobs/beans/login/JobsUserLoginWebSessionBean.java b/src/java/org/mxchange/jjobs/beans/login/JobsUserLoginWebSessionBean.java index e2fcec24..34387d8a 100644 --- a/src/java/org/mxchange/jjobs/beans/login/JobsUserLoginWebSessionBean.java +++ b/src/java/org/mxchange/jjobs/beans/login/JobsUserLoginWebSessionBean.java @@ -16,6 +16,8 @@ */ package org.mxchange.jjobs.beans.login; +import java.util.Collections; +import java.util.List; import java.util.Objects; import javax.enterprise.context.SessionScoped; import javax.enterprise.event.Event; @@ -39,6 +41,8 @@ import org.mxchange.jusercore.exceptions.UserStatusUnconfirmedException; import org.mxchange.jusercore.model.login.UserLoginSessionBeanRemote; import org.mxchange.jusercore.model.user.User; import org.mxchange.jusercore.model.user.UserUtils; +import org.mxchange.jusercore.model.user.password_history.PasswordHistory; +import org.mxchange.jusercore.model.user.password_history.UserPasswordHistorySessionBeanRemote; import org.mxchange.jusercore.model.user.profilemodes.ProfileMode; import org.mxchange.jusercore.model.user.status.UserAccountStatus; @@ -77,7 +81,7 @@ public class JobsUserLoginWebSessionBean extends BaseJobsController implements J private User loggedInUser; /** - * Remote register session bean + * EJB for user-login */ private UserLoginSessionBeanRemote loginBean; @@ -105,6 +109,16 @@ public class JobsUserLoginWebSessionBean extends BaseJobsController implements J */ private boolean userLoggedIn; + /** + * User's password history + */ + private List userPasswordHistory; + + /** + * EJB for user's password history + */ + private UserPasswordHistorySessionBeanRemote userPasswordHistoryBean; + /** * Default constructor */ @@ -115,6 +129,12 @@ public class JobsUserLoginWebSessionBean extends BaseJobsController implements J // Try to lookup this.loginBean = (UserLoginSessionBeanRemote) context.lookup("java:global/jjobs-ejb/login!org.mxchange.jusercore.model.login.UserLoginSessionBeanRemote"); //NOI18N + + // Also find this + this.userPasswordHistoryBean = (UserPasswordHistorySessionBeanRemote) context.lookup(""); //NOI18N + + // Defaul template is guest + this.baseTemplatePathName = GUEST_BASE_TEMPLATE_NAME; } catch (final NamingException ex) { // Continue to throw throw new FaceletException(ex); @@ -136,6 +156,9 @@ public class JobsUserLoginWebSessionBean extends BaseJobsController implements J // All fine here so set it here this.setLoggedInUser(confirmedUser); + // Retrieve user's password list + this.userPasswordHistory = this.userPasswordHistoryBean.getUserPasswordHistory(confirmedUser); + // Set template to "login" this.setTemplateType("login"); //NOI18N @@ -176,13 +199,8 @@ public class JobsUserLoginWebSessionBean extends BaseJobsController implements J } @Override - public String getTemplateType () { - return this.templateType; - } - - @Override - public void setTemplateType (final String templateType) { - this.templateType = templateType; + public List getUserPasswordHistory () { + return Collections.unmodifiableList(this.userPasswordHistory); } @Override diff --git a/src/java/org/mxchange/jjobs/beans/login/JobsUserLoginWebSessionController.java b/src/java/org/mxchange/jjobs/beans/login/JobsUserLoginWebSessionController.java index 5c21a223..fe96c0a0 100644 --- a/src/java/org/mxchange/jjobs/beans/login/JobsUserLoginWebSessionController.java +++ b/src/java/org/mxchange/jjobs/beans/login/JobsUserLoginWebSessionController.java @@ -17,13 +17,17 @@ package org.mxchange.jjobs.beans.login; import java.io.Serializable; +import java.util.List; +import javax.ejb.Local; import org.mxchange.jusercore.model.user.User; +import org.mxchange.jusercore.model.user.password_history.PasswordHistory; /** * An interface for registration web controllers *

* @author Roland Haeder */ +@Local public interface JobsUserLoginWebSessionController extends Serializable { /** @@ -104,4 +108,11 @@ public interface JobsUserLoginWebSessionController extends Serializable { */ boolean ifCurrentPasswordMatches (); + /** + * Getter for user's password history + *

+ * @return User's password history + */ + List getUserPasswordHistory (); + }