Author: pgil
Date: Tue Aug  7 09:35:41 2018
New Revision: 1837586

URL: http://svn.apache.org/viewvc?rev=1837586&view=rev
Log:
Fixed: Initial set of hasLoggedOut flag when logging in
(OFBIZ-10506)

Thanks Dennis for your patch

Modified:
    
ofbiz/branches/release16.11/framework/common/src/main/java/org/apache/ofbiz/common/login/LoginServices.java

Modified: 
ofbiz/branches/release16.11/framework/common/src/main/java/org/apache/ofbiz/common/login/LoginServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/release16.11/framework/common/src/main/java/org/apache/ofbiz/common/login/LoginServices.java?rev=1837586&r1=1837585&r2=1837586&view=diff
==============================================================================
--- 
ofbiz/branches/release16.11/framework/common/src/main/java/org/apache/ofbiz/common/login/LoginServices.java
 (original)
+++ 
ofbiz/branches/release16.11/framework/common/src/main/java/org/apache/ofbiz/common/login/LoginServices.java
 Tue Aug  7 09:35:41 2018
@@ -183,8 +183,7 @@ public class LoginServices {
                             
"Y".equalsIgnoreCase(userLogin.getString("isSystem")) : false;
 
                     // grab the hasLoggedOut flag
-                    boolean hasLoggedOut = userLogin.get("hasLoggedOut") != 
null ?
-                            
"Y".equalsIgnoreCase(userLogin.getString("hasLoggedOut")) : false;
+                    Boolean hasLoggedOut = 
userLogin.getBoolean("hasLoggedOut");
 
                     if ((UtilValidate.isEmpty(userLogin.getString("enabled")) 
|| "Y".equals(userLogin.getString("enabled")) ||
                             (reEnableTime != null && 
reEnableTime.before(UtilDateTime.nowTimestamp())) || (isSystem)) && 
UtilValidate.isEmpty(userLogin.getString("disabledBy"))) {
@@ -214,7 +213,7 @@ public class LoginServices {
                             Debug.logVerbose("[LoginServices.userLogin] : 
Password Matched", module);
 
                             // update the hasLoggedOut flag
-                            if (hasLoggedOut) {
+                            if (hasLoggedOut == null || hasLoggedOut) {
                                 userLogin.set("hasLoggedOut", "N");
                             }
 
@@ -222,7 +221,7 @@ public class LoginServices {
                             Long currentFailedLogins = 
userLogin.getLong("successiveFailedLogins");
                             if (currentFailedLogins != null && 
currentFailedLogins.longValue() > 0) {
                                 userLogin.set("successiveFailedLogins", 
Long.valueOf(0));
-                            } else if (!hasLoggedOut) {
+                            } else if (hasLoggedOut != null && !hasLoggedOut) {
                                 // successful login & no loggout flag, no need 
to change anything, so don't do the store
                                 doStore = false;
                             }


Reply via email to