Skip to content

Commit

Permalink
refacror...
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamer0x01 authored Aug 2, 2022
1 parent 8316a6c commit 26ab77f
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions assets/snippets/FormLister/plugin.userHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,10 @@
}
//Updating session_id in cookie, if user is login and just saved
if ($e->name == 'OnWebSaveUser' && isset($userObj)) {
if( (int)$modx->getLoginUserID('web') == (int)$id) { //checking, if current logined user was saved
if (isset($_COOKIE[$cookieName])) {
$cookieParts = explode("|", $_COOKIE[$cookieName], 4);
if(isset($cookieParts[2])) {
if ($userObj->get('sessionid') != $cookieParts[2]) { //checking, if session ids in cookie and in user object became not equals
$userObj->setAutoLoginCookie($cookieName, $cookieLifetime);
}
}
if( (int)$modx->getLoginUserID('web') == (int)$id && isset($_COOKIE[$cookieName]) ) { //checking, if current logined user was saved
$cookieParts = explode("|", $_COOKIE[$cookieName], 4);
if(isset($cookieParts[2]) && ($userObj->get('sessionid') != $cookieParts[2])) { //checking, if session ids in cookie and in user object became not equals
$userObj->setAutoLoginCookie($cookieName, $cookieLifetime);
}
}
}
Expand Down

0 comments on commit 26ab77f

Please sign in to comment.