Add logout redirection functionality
This commit is contained in:
parent
b24d466649
commit
5de0871171
1 changed files with 19 additions and 1 deletions
20
auth.php
20
auth.php
|
@ -88,7 +88,7 @@ class auth_plugin_userkey extends auth_plugin_base {
|
|||
* @throws \moodle_exception If something went wrong.
|
||||
*/
|
||||
public function user_login_userkey() {
|
||||
global $DB;
|
||||
global $DB, $SESSION;
|
||||
|
||||
$keyvalue = required_param('key', PARAM_ALPHANUM);
|
||||
$wantsurl = optional_param('wantsurl', '', PARAM_URL);
|
||||
|
@ -127,6 +127,9 @@ class auth_plugin_userkey extends auth_plugin_base {
|
|||
$user = get_complete_user_data('id', $user->id);
|
||||
complete_user_login($user);
|
||||
|
||||
// Identify this session as using user key auth method.
|
||||
$SESSION->userkey = true;
|
||||
|
||||
if (!empty($wantsurl)) {
|
||||
return $wantsurl;
|
||||
} else {
|
||||
|
@ -380,4 +383,19 @@ class auth_plugin_userkey extends auth_plugin_base {
|
|||
|
||||
return $parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Logout page hook.
|
||||
*
|
||||
* Override redirect URL after logout.
|
||||
*
|
||||
* @see auth_plugin_base::logoutpage_hook()
|
||||
*/
|
||||
public function logoutpage_hook() {
|
||||
global $redirect, $SESSION;
|
||||
|
||||
if (!empty($this->config->redirecturl) && isset($SESSION->userkey)) {
|
||||
$redirect = $this->config->redirecturl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue