Skip to content

Commit

Permalink
Fix Validate Password filter (#309)
Browse files Browse the repository at this point in the history
Fixes #308
  • Loading branch information
michael-e authored and nitriques committed Jun 4, 2018
1 parent 743b382 commit 8078923
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/member.symphony.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public function login(array $credentials, $isHashed = false) {
if (isset($credentials[$this->section->getFieldHandle('authentication')])){
$this->cookie->set('password', $this->getMember()->getData($this->section->getField('authentication')->get('id'), true)->password);
}

self::$isLoggedIn = true;

} catch (Exception $ex){
Expand Down Expand Up @@ -413,13 +413,15 @@ public function filter_ValidatePassword(array &$context) {
$password = $_POST['fields'][$this->section->getFieldHandle('authentication')]['validate'];

if ($password) {
// Handle which is the Identity field, either the Member: Username or Member: Email field
$identity = is_null($this->section->getFieldHandle('identity')) ? 'email' : 'identity';
// Handle which is the Identity field, either the Member: Username or Member: Email field;
// the data array passed to findMemberIDFromCredentials() needs either 'username' or
// 'email' as key, so we must not use the string 'identity' in this case.
$identity = is_null($this->section->getFieldHandle('identity')) ? 'email' : 'username';

$member_id = $this->findMemberIDFromCredentials(
array(
$this->section->getFieldHandle($identity) => $member->getData($this->section->getField($identity)->get('id'), true)->value,
$this->section->getFieldHandle('authentication') => $password
$identity => $member->getData($this->section->getField($identity)->get('id'), true)->value,
'password' => $password
),
false
);
Expand Down

0 comments on commit 8078923

Please sign in to comment.