if (!isDefined("session.tokens.employee.contributions.token")){
"session.tokens.employee.contributions" = {
"token": LCase(Hash("#CreateUUID()#employee.contributions#RandRange(10000,99999)#", "SHA-256")),
"expires": dateAdd("h", 2, Now())
}
}
<input type="hidden" id="csrftoken" name="csrftoken" value="#session.tokens.employee.contributions.token#"/>
if (session.tokens.employee.contributions.token != form.csrftoken){
variables.isValidToken = false;
}
Version Lucee 4.5.2.017 finalOS Mac OS X (10.11.2) 64bitServlet Container Apache Tomcat/8.0.15Java 1.7.0_65 (Oracle Corporation) 64bit
thread name="errorReport" {
application.bugLogService.notifyService(message="The default date for the account is invalid.", extraInfo=form, severityCode="INFO");
}
If you want the thread to use the existing session scope, then you need to pass it in as a parameter:
SESSION.someSetting= true;
SESSION.someOtherSetting = 'Yes';
//note that we are explicitly passing in the shared scope to use
thread action="run" name="TestSharedScope" session=SESSION {
SESSION.someOtherSetting = "NO";
}
thread name="TestSharedScope" action="join";
//Now the session will reflect the change to our shared scope
writeDump(var=SESSION,top=1);
abort;
By design, a thread cannot use any object unless it is explicitly passed in to the thread. Since the SESSION
scope is a global of the server, if the scope is not passed in for use, the server creates a new one.
--
Love Lucee? Become a supporter and be part of the Lucee project today! - http://lucee.org/supporters/become-a-supporter.html
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/81eb85df-f378-4496-9c0a-c3400f325ecf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I see. In an async situation, of course, your session keys will be out of sync. That said, if you explicitly pass in the session scope, you should see the reference maintained according to the sequence in which those are modified:
structClear(session);
SESSION.otherValue= true;
SESSION.somevalue = 'Yes';
SESSION.page1='/page1';
thread action="run" name="TestSharedScope" session=SESSION {
SESSION.somevalue = "NO";
}
thread name="TestSharedScope" action="join";
thread action="run" name="TestSharedScope2" session=SESSION {
thread name="TestSharedScope2" action="sleep" duration=4000;
SESSION.someOthervalue = "Here is my new value";
}
//We won't see SESSION.someOtherValue yet because of the sleep
writeDump(var=session,top=1);
SESSION.page2='/page2';
thread name="TestSharedScope2" action="join";
//Now the session will reflect all the changes made to our shared scope
writeDump(var=SESSION,top=1);
abort;
That said, modifying anything in the scope that involves out-of-sequence database writes is probably a recipe for failure. If you need access to the existing session scope, in the the thread, I would suggest passing it in as a new variable via duplicate(session) so that any setting of keys to the actual scope is done outside of the thread.
--
Love Lucee? Become a supporter and be part of the Lucee project today! - http://lucee.org/supporters/become-a-supporter.html
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/d7aefe28-e943-43ad-812b-927e77f8a7fe%40googlegroups.com.