Skip to content
Permalink
Browse files

Authenticator: uses instance of Passwords

  • Loading branch information...
dg committed Feb 1, 2019
1 parent 995e740 commit c6d05633f8a123664bd1ef8cd1fd96963c62db18
Showing with 6 additions and 2 deletions.
  1. +6 −2 CD-collection/app/model/Authenticator.php
@@ -18,10 +18,14 @@ class Authenticator implements Security\IAuthenticator
/** @var Nette\Database\Context */
private $database;
/** @var Security\Passwords */
private $passwords;
public function __construct(Nette\Database\Context $database)
public function __construct(Nette\Database\Context $database, Security\Passwords $passwords)
{
$this->database = $database;
$this->passwords = $passwords;
}
@@ -37,7 +41,7 @@ public function authenticate(array $credentials): Security\IIdentity
if (!$row) {
throw new Security\AuthenticationException('The username is incorrect.', self::IDENTITY_NOT_FOUND);
} elseif (!Security\Passwords::verify($password, $row->password)) {
} elseif (!$this->passwords->verify($password, $row->password)) {
throw new Security\AuthenticationException('The password is incorrect.', self::INVALID_CREDENTIAL);
}

0 comments on commit c6d0563

Please sign in to comment.
You can’t perform that action at this time.