diff --git a/auth.php b/auth.php index 73fa83b..b61c9e9 100644 --- a/auth.php +++ b/auth.php @@ -153,18 +153,11 @@ public function user_login_userkey() { try { $key = $this->userkeymanager->validate_key($keyvalue); } catch (moodle_exception $exception) { - // If user is logged in and key is not valid, we'd like to logout a user. - if (isloggedin()) { - require_logout(); - } print_error($exception->errorcode); } if (isloggedin()) { - if ($USER->id != $key->userid) { - // Logout the current user if it's different to one that associated to the valid key. - require_logout(); - } else { + if ($USER->id == $key->userid) { // Don't process further if the user is already logged in. $this->userkeymanager->delete_keys($key->userid); $this->redirect($redirecturl);