Skip to content
Snippets Groups Projects
Commit 6571f3bf authored by aydreeihn's avatar aydreeihn
Browse files

login: Fix CSRF fail, add shake effect on authentication fail #3955 (minor fix...

login: Fix CSRF fail, add shake effect on authentication fail #3955 (minor fix to SQL query generated)
parent 2f51a8b8
Branches
Tags
No related merge requests found
...@@ -183,10 +183,12 @@ extends SessionBackend { ...@@ -183,10 +183,12 @@ extends SessionBackend {
function read($id) { function read($id) {
try { try {
$this->data = SessionData::objects() $this->data = SessionData::objects()
->filter(['session_id' => $id]) ->filter(['session_id' => $id])
->annotate(['age' => SqlFunction::NOW()->minus(new SqlField('session_expire'))]) ->annotate(array('is_expired' =>
->one(); new SqlExpr(new Q(array('session_expire__lt' => SqlFunction::NOW())))))
if ($this->data->age > 0) { ->one();
if ($this->data->is_expired > 0) {
// session_expire is in the past. Pretend it is expired and // session_expire is in the past. Pretend it is expired and
// reset the data. This will assist with CSRF issues // reset the data. This will assist with CSRF issues
$this->data->session_data=''; $this->data->session_data='';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment