From 92c8cb9d987aad70082bb36c941af9070c51ec8b Mon Sep 17 00:00:00 2001 From: Simey Lameze Date: Mon, 19 Jun 2017 12:08:05 +0800 Subject: [PATCH] MDL-59275 auth: prevent user login failed coding error --- auth/oauth2/classes/auth.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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();