Fixed: setUserTimeZone should ran only once based on error
(OFBIZ-11329) This will be notably useful when committing CSRF solution as explained in OFBIZ-11306: SetTimeZoneFromBrowser when starting gives a RequestHandlerException: Invalid or missing CSRF token for AJAX call to path '/SetTimeZoneFromBrowser'. Also not only when starting. Thanks: James Yong for review
This commit is contained in:
@@ -20,13 +20,14 @@
|
||||
import org.apache.ofbiz.service.ServiceUtil
|
||||
|
||||
public Map SetTimeZoneFromBrowser() {
|
||||
Map results = ServiceUtil.returnSuccess()
|
||||
userLogin = from("UserLogin").where("userLoginId", parameters.userLogin.userLoginId).queryFirst();
|
||||
if (userLogin) {
|
||||
if (!userLogin.lastTimeZone || "null".equals(userLogin.lastTimeZone)) {
|
||||
userLogin.lastTimeZone = parameters.localeName
|
||||
userLogin.store()
|
||||
return ServiceUtil.returnSuccess()
|
||||
}
|
||||
} else {
|
||||
return ServiceUtil.returnError()
|
||||
}
|
||||
return results
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user