File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -123,10 +123,12 @@ use Nette\Security as NS;
123123class MyAuthenticator implements NS\IAuthenticator
124124{
125125 public $database;
126+ public $passwords;
126127
127- function __construct(Nette\Database\Connection $database)
128+ function __construct(Nette\Database\Connection $database, NS\Passwords $passwords )
128129 {
129130 $this->database = $database;
131+ $this->passwords = $password;
130132 }
131133
132134 function authenticate(array $credentials)
@@ -139,7 +141,7 @@ class MyAuthenticator implements NS\IAuthenticator
139141 throw new NS\AuthenticationException('User not found.');
140142 }
141143
142- if (!NS\Passwords:: verify($password, $row->password)) {
144+ if (!$passwords-> verify($password, $row->password)) {
143145 throw new NS\AuthenticationException('Invalid password.');
144146 }
145147
@@ -153,9 +155,8 @@ Class `MyAuthenticator` communicates with the database using Nette\Database laye
153155This authenticator would be configured in the ` config.neon ` file like this:
154156
155157```
156- common:
157- services:
158- authenticator: MyAuthenticator
158+ services:
159+ authenticator: MyAuthenticator
159160```
160161
161162
You can’t perform that action at this time.
0 commit comments