Skip to content
Permalink
Browse files

readme: Updated (#39)

Fix doc to get via DIC, prevent:
Deprecated Non-static method Nette\Security\Passwords::verify() should not be called statically
  • Loading branch information
kravcik authored and dg committed Jan 13, 2020
1 parent bb3e14d commit db73664b99e609f586b4d18b94a4414c01c2b149
Showing with 6 additions and 5 deletions.
  1. +6 −5 readme.md
@@ -123,10 +123,12 @@ use Nette\Security as NS;
class MyAuthenticator implements NS\IAuthenticator
{
public $database;
public $passwords;
function __construct(Nette\Database\Connection $database)
function __construct(Nette\Database\Connection $database, NS\Passwords $passwords)
{
$this->database = $database;
$this->passwords = $password;
}
function authenticate(array $credentials)
@@ -139,7 +141,7 @@ class MyAuthenticator implements NS\IAuthenticator
throw new NS\AuthenticationException('User not found.');
}
if (!NS\Passwords::verify($password, $row->password)) {
if (!$passwords->verify($password, $row->password)) {
throw new NS\AuthenticationException('Invalid password.');
}
@@ -153,9 +155,8 @@ Class `MyAuthenticator` communicates with the database using Nette\Database laye
This authenticator would be configured in the `config.neon` file like this:

```
common:
services:
authenticator: MyAuthenticator
services:
authenticator: MyAuthenticator
```


0 comments on commit db73664

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