This is an automated email from the ASF dual-hosted git repository.
deepak pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/trunk by this push:
new fb51a0ea5c Replaced direct null checks on username, password, and
token with UtilValidate.isEmpty() method calls for consistency.
fb51a0ea5c is described below
commit fb51a0ea5c4f7ff95b1586a5ca1c26e1ec50736f
Author: Deepak Dixit <[email protected]>
AuthorDate: Thu Dec 14 17:29:28 2023 +0530
Replaced direct null checks on username, password, and token with
UtilValidate.isEmpty() method calls for consistency.
---
.../main/java/org/apache/ofbiz/webapp/control/LoginWorker.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git
a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java
b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java
index 401edd3a9c..322448a3c1 100644
---
a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java
+++
b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java
@@ -338,8 +338,8 @@ public final class LoginWorker {
if (token == null) token = (String) session.getAttribute("TOKEN");
// in this condition log them in if not already; if not logged in
or can't log in, save parameters and return error
- if (username == null
- || (password == null && token == null)
+ if (UtilValidate.isEmpty(username)
+ || (UtilValidate.isEmpty(password) &&
UtilValidate.isEmpty(token))
|| "error".equals(login(request, response))) {
// make sure this attribute is not in the request; this avoids
infinite recursion when a login by less stringent criteria
@@ -417,9 +417,9 @@ public final class LoginWorker {
}
}
- if (username == null) username = (String)
session.getAttribute("USERNAME");
- if (password == null) password = (String)
session.getAttribute("PASSWORD");
- if (token == null) token = (String) session.getAttribute("TOKEN");
+ if (UtilValidate.isEmpty(username)) username = (String)
session.getAttribute("USERNAME");
+ if (UtilValidate.isEmpty(password)) password = (String)
session.getAttribute("PASSWORD");
+ if (UtilValidate.isEmpty(token)) token = (String)
session.getAttribute("TOKEN");
// allow a username and/or password in a request attribute to override
the request parameter or the session attribute;
// this way a preprocessor can play with these a bit...