Skip to content
Snippets Groups Projects
Unverified Commit 7176f792 authored by ufundo's avatar ufundo Committed by GitHub
Browse files

Merge pull request #32402 from totten/6.1-std-upg-logout

(#5594) Upgrade - Don't drop the current user ID after upgrade
parents 6fc97921 d352ef60
Branches
No related tags found
No related merge requests found
......@@ -152,10 +152,21 @@ class CRM_Core_Session {
/**
* Resets the session store.
*
* @param int $all
* @param int|string $mode
* 1: Default mode. Deletes the `CiviCRM` data from $_SESSION.
* 2: More invasive version of that. (somehow)
* 'keep_login': Less invasive. Preserve basic data (current user ID) from this session. Reset everything else.
*/
public function reset($all = 1) {
if ($all != 1) {
public function reset($mode = 1) {
if ($mode === 'keep_login') {
if (!empty($this->_session[$this->_key])) {
$this->_session[$this->_key] = CRM_Utils_Array::subset(
$this->_session[$this->_key],
['ufID', 'userID', 'authx']
);
}
}
elseif ($mode != 1) {
$this->initialize();
// to make certain we clear it, first initialize it to empty
......
......@@ -843,7 +843,7 @@ SET version = '$version'
*/
public static function doFinish(): bool {
$session = CRM_Core_Session::singleton();
$session->reset(2);
$session->reset('keep_login');
return TRUE;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment