]> git.mxchange.org Git - jjobs-war.git/commitdiff
Continued a bit: (please cherry-pick)
authorRoland Häder <roland@mxchange.org>
Wed, 3 Aug 2016 09:03:18 +0000 (11:03 +0200)
committerRoland Haeder <roland@mxchange.org>
Sun, 7 Aug 2016 10:17:01 +0000 (12:17 +0200)
- added retrival of user's password history for current user (not admin)
- added getter in interface

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

index e2fcec24f81b82703b96ba7c5e115de5b13f6857..34387d8a282c1153ca7a13041ef37dadd968ed9a 100644 (file)
@@ -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<PasswordHistory> 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<PasswordHistory> getUserPasswordHistory () {
+               return Collections.unmodifiableList(this.userPasswordHistory);
        }
 
        @Override
index 5c21a2230ae0ac4223dd57d95f6c32d82a9c78d6..fe96c0a0020450c7bad515d3deff54271f70af4a 100644 (file)
 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
  * <p>
  * @author Roland Haeder<roland@mxchange.org>
  */
+@Local
 public interface JobsUserLoginWebSessionController extends Serializable {
 
        /**
@@ -104,4 +108,11 @@ public interface JobsUserLoginWebSessionController extends Serializable {
         */
        boolean ifCurrentPasswordMatches ();
 
+       /**
+        * Getter for user's password history
+        * <p>
+        * @return User's password history
+        */
+       List<PasswordHistory> getUserPasswordHistory ();
+
 }