]> git.mxchange.org Git - jjobs-war.git/blobdiff - src/java/org/mxchange/jjobs/beans/login/JobsUserLoginWebSessionBean.java
Continued a bit: (please cherry-pick)
[jjobs-war.git] / src / java / org / mxchange / jjobs / beans / login / JobsUserLoginWebSessionBean.java
index 51ade0eac9fe4a8632ad13d59f990002891d741e..e2fcec24f81b82703b96ba7c5e115de5b13f6857 100644 (file)
@@ -51,6 +51,16 @@ import org.mxchange.jusercore.model.user.status.UserAccountStatus;
 @SessionScoped
 public class JobsUserLoginWebSessionBean extends BaseJobsController implements JobsUserLoginWebSessionController {
 
+       /**
+        * Path name for guest base template
+        */
+       private static final String GUEST_BASE_TEMPLATE_NAME = "guest/guest"; //NOI18N
+
+       /**
+        * Path name for logged-in user base template
+        */
+       private static final String USER_BASE_TEMPLATE_NAME = "login/user/user"; //NOI18N
+
        /**
         * Serial number
         */
@@ -134,9 +144,14 @@ public class JobsUserLoginWebSessionBean extends BaseJobsController implements J
 
                        // All fine
                        return "login"; //NOI18N
-               } catch (final UserNotFoundException | UserStatusLockedException | UserStatusUnconfirmedException | UserPasswordMismatchException ex) {
-                       // Throw again
-                       throw new FaceletException(ex);
+               } catch (final UserNotFoundException | UserStatusLockedException | UserStatusUnconfirmedException ex) {
+                       // Show JSF message
+                       this.showFacesMessage("form_user_login:userName", ex); //NOI18N
+                       return ""; //NOI18N
+               } catch (final UserPasswordMismatchException ex) {
+                       // Show JSF message
+                       this.showFacesMessage("form_user_login:userPassword", ex); //NOI18N
+                       return ""; //NOI18N
                }
        }
 
@@ -189,8 +204,8 @@ public class JobsUserLoginWebSessionBean extends BaseJobsController implements J
        }
 
        @Override
-       public boolean isGuest () {
-               return (!this.isUserLoggedIn());
+       public boolean ifUserMustChangePassword () {
+               return (this.isUserLoggedIn() && this.getLoggedInUser().getUserMustChangePassword());
        }
 
        @Override
@@ -208,13 +223,14 @@ public class JobsUserLoginWebSessionBean extends BaseJobsController implements J
        @Override
        public boolean isUserLoggedIn () {
                // Trace message
-               // NOISY-DEBUG System.out.println(MessageFormat.format("RecruiterUserLoginWebSessionBean:isUserLoggedIn: this.loggedInUser={0},this.templateType={1} - CALLED!", this.getLoggedInUser(), this.getTemplateType()));
+               // NOISY-DEBUG System.out.println(MessageFormat.format("JobsUserLoginWebSessionBean:isUserLoggedIn: this.loggedInUser={0},this.templateType={1} - CALLED!", this.getLoggedInUser(), this.getTemplateType()));
 
                // Compare instance
                this.userLoggedIn = ((this.getLoggedInUser() instanceof User) && (Objects.equals(this.getLoggedInUser().getUserAccountStatus(), UserAccountStatus.CONFIRMED)));
 
                // Trace message
-               // NOISY-DEBUG System.out.println(MessageFormat.format("RecruiterUserLoginWebSessionBean:isUserLoggedIn: this.userLoggedIn={0} - EXIT!", this.userLoggedIn));
+               // NOISY-DEBUG System.out.println(MessageFormat.format("JobsUserLoginWebSessionBean:isUserLoggedIn: this.userLoggedIn={0} - EXIT!", this.userLoggedIn));
+
                // Return it
                return this.userLoggedIn;
        }