Skip to content

Commit

Permalink
Fixed issue 15968: Deleted user not being completely logged out
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Mar 17, 2020
1 parent 255ba70 commit 0cacdee
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion application/controllers/AdminController.php
Expand Up @@ -34,7 +34,12 @@ protected function _init()
$this->_sessioncontrol();

$this->user_id = Yii::app()->user->getId();

// Check if the user really exists
// This scenario happens if the user was deleted while still being logged in
if ( !empty( $this->user_id ) && User::model()->findByPk( $this->user_id ) == null ){
$this->user_id = null;
}

if (!Yii::app()->getConfig("surveyid")) {Yii::app()->setConfig("surveyid", returnGlobal('sid')); } //SurveyID
if (!Yii::app()->getConfig("surveyID")) {Yii::app()->setConfig("surveyID", returnGlobal('sid')); } //SurveyID
if (!Yii::app()->getConfig("ugid")) {Yii::app()->setConfig("ugid", returnGlobal('ugid')); } //Usergroup-ID
Expand Down Expand Up @@ -134,6 +139,7 @@ public function run($action)


if ($action != "databaseupdate" && $action != "db") {

if (empty($this->user_id) && $action != "authentication" && $action != "remotecontrol") {
if (!empty($action) && $action != 'index') {
Yii::app()->session['redirect_after_login'] = $this->createUrl('/');
Expand Down

1 comment on commit 0cacdee

@Shnoulle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This scenario happens if the user was deleted while still being logged in

😲 you see this in real ! All can happen !

Please sign in to comment.