avoid crash when no privatetoken on authentication

Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
This commit is contained in:
Julien Veyssier 2020-12-07 15:25:05 +01:00
parent 330baee5be
commit 6467d48f3e
No known key found for this signature in database
GPG key ID: 4141FEE162030638

View file

@ -87,7 +87,7 @@ class MoodleAPIController extends Controller {
if (!isset($result['error'])) {
// we save the client ID and secret and give the client ID back to the UI
$this->config->setUserValue($this->userId, Application::APP_ID, 'token', $result['token']);
$this->config->setUserValue($this->userId, Application::APP_ID, 'privatetoken', $result['privatetoken']);
$this->config->setUserValue($this->userId, Application::APP_ID, 'privatetoken', $result['privatetoken'] ?? '');
// get user info
$chosenName = $login;
$params = [