diff --git a/auth/oauth2/classes/auth.php b/auth/oauth2/classes/auth.php index 812cf988e82..aa5f70ce93b 100644 --- a/auth/oauth2/classes/auth.php +++ b/auth/oauth2/classes/auth.php @@ -346,7 +346,7 @@ class auth extends \auth_plugin_base { * Complete the login process after oauth handshake is complete. * @param \core\oauth2\client $client * @param string $redirecturl - * @return none Either redirects or throws an exception + * @return void Either redirects or throws an exception */ public function complete_login(client $client, $redirecturl) { global $CFG, $SESSION, $PAGE; @@ -356,7 +356,7 @@ class auth extends \auth_plugin_base { if (!$userinfo) { // Trigger login failed event. $failurereason = AUTH_LOGIN_NOUSER; - $event = \core\event\user_login_failed::create(['other' => ['username' => $userinfo['username'], + $event = \core\event\user_login_failed::create(['other' => ['username' => 'unknown', 'reason' => $failurereason]]); $event->trigger(); @@ -368,7 +368,7 @@ class auth extends \auth_plugin_base { if (empty($userinfo['username']) || empty($userinfo['email'])) { // Trigger login failed event. $failurereason = AUTH_LOGIN_NOUSER; - $event = \core\event\user_login_failed::create(['other' => ['username' => $userinfo['username'], + $event = \core\event\user_login_failed::create(['other' => ['username' => 'unknown', 'reason' => $failurereason]]); $event->trigger();