diff --git a/classes/loginflow/authcode.php b/classes/loginflow/authcode.php index a446cfd..acc7bc4 100644 --- a/classes/loginflow/authcode.php +++ b/classes/loginflow/authcode.php @@ -106,7 +106,9 @@ public function handleredirect() { // Response from OP. $this->handleauthresponse($requestparams); } else { - if (isloggedin() && empty($justauth) && empty($promptaconsent)) { + if (isloggedin() && !isguestuser() && empty($justauth) && empty($promptaconsent)) { + global $USER; + if($USER->id ) if (isset($SESSION->wantsurl) and (strpos($SESSION->wantsurl, $CFG->wwwroot) === 0)) { $urltogo = $SESSION->wantsurl; unset($SESSION->wantsurl); @@ -116,6 +118,10 @@ public function handleredirect() { redirect($urltogo); die(); } + //Handle Guest account session termination + if(isguestuser()){ + require_logout(); + } // Initial login request. $stateparams = ['forceflow' => 'authcode']; $extraparams = [];