Merge branch 'MDL-59889-master' of git://github.com/Dagefoerde/moodle

This commit is contained in:
Damyon Wiese
2017-10-10 13:05:31 +08:00
+3 -9
View File
@@ -215,15 +215,9 @@ class client extends \oauth2_client {
$this->store_token($accesstoken);
if (isset($r->refresh_token)) {
$userinfo = $this->get_userinfo();
if ($userinfo['email'] == $systemaccount->get('email')) {
$systemaccount->set('refreshtoken', $r->refresh_token);
$systemaccount->update();
$this->refreshtoken = $r->refresh_token;
} else {
throw new moodle_exception('Attempt to store refresh token for non-system user.');
}
$systemaccount->set('refreshtoken', $r->refresh_token);
$systemaccount->update();
$this->refreshtoken = $r->refresh_token;
}
return true;