Skip to content

Commit

Permalink
MDL-59275 auth: prevent user login failed coding error
Browse files Browse the repository at this point in the history
  • Loading branch information
lameze committed Jun 27, 2017
1 parent 6bb80a1 commit 92c8cb9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions auth/oauth2/classes/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ public function print_confirm_required($title, $message) {
* 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;
Expand All @@ -356,7 +356,7 @@ public function complete_login(client $client, $redirecturl) {
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();

Expand All @@ -368,7 +368,7 @@ public function complete_login(client $client, $redirecturl) {
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();

Expand Down

0 comments on commit 92c8cb9

Please sign in to comment.