MDL-58220 oauth2: Don't login as deleted users

Also prevent sesskey error on first page of new logins.
This commit is contained in:
Damyon Wiese 2017-03-31 10:31:53 +08:00
parent 7f15866006
commit 512e681a3b
2 changed files with 10 additions and 2 deletions

View File

@ -76,7 +76,15 @@ class api {
'issuerid' => $issuer->get('id'),
'username' => $username
];
return linked_login::get_record($params);
$result = linked_login::get_record($params);
if ($result) {
$user = \core_user::get_user($result->get('userid'));
if (!empty($user) && !$user->deleted) {
return $result;
}
}
return false;
}
/**

View File

@ -25,7 +25,7 @@
require_once('../../config.php');
$issuerid = required_param('id', PARAM_INT);
$wantsurl = new moodle_url(optional_param('wantsurl', '/', PARAM_URL));
$wantsurl = new moodle_url(optional_param('wantsurl', '', PARAM_URL));
require_sesskey();