Skip to content

Commit

Permalink
That broke a few things, we do need the check here
Browse files Browse the repository at this point in the history
  • Loading branch information
Firesphere committed Oct 24, 2018
1 parent 1d36e21 commit 9f81de2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/controllers/LoginHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,13 @@ public function doLogin($data, MemberLoginForm $form, HTTPRequest $request)
// Also, exclude default admin from forcing a reset
if (!$isDefaultAdmin && !HaveIBeenPwnedService::config()->get('allow_pwnd')) {
$password = $data['Password'];
$member = $this->checkLogin($data, $request, $result);
$member = null;
$identifierField = Member::config()->get('unique_identifier_field');
$memberCount = Member::get()->filter([$identifierField => $data['Email']])->count();
// There's no need to check for the member if it doesn't exist
if ($memberCount !== 0) {
$member = $this->checkLogin($data, $request, $result);
}

// How often can we find this password?
$breachCount = $this->service->checkPwnedPassword($password);
Expand All @@ -73,8 +79,8 @@ public function doLogin($data, MemberLoginForm $form, HTTPRequest $request)
$this->lockoutMember($member, $breachCount);
}

if (!$member || $breachCount) {
// A breached member or a non-existing member get the reset form
// A breached member or a non-existing member get the reset form
if (($breachCount && $member) || !$memberCount) {
return $this->redirectToResetPassword();
}
}
Expand Down

0 comments on commit 9f81de2

Please sign in to comment.