Skip to content

Commit

Permalink
There was a bit a double-up on checking if the member existed
Browse files Browse the repository at this point in the history
  • Loading branch information
Firesphere committed Oct 24, 2018
1 parent 41e4349 commit 1d36e21
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/controllers/LoginHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,7 @@ 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 = 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);
}
$member = $this->checkLogin($data, $request, $result);

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

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

0 comments on commit 1d36e21

Please sign in to comment.