Skip to content
This repository was archived by the owner on Mar 14, 2023. It is now read-only.

Commit 3c037b6

Browse files
committed
uses Nette 3.1 features
1 parent 561589a commit 3c037b6

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

app/Model/UserManager.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/**
1212
* Users management.
1313
*/
14-
final class UserManager implements Nette\Security\IAuthenticator
14+
final class UserManager implements Nette\Security\Authenticator
1515
{
1616
use Nette\SmartObject;
1717

@@ -24,12 +24,12 @@ final class UserManager implements Nette\Security\IAuthenticator
2424
COLUMN_ROLE = 'role';
2525

2626

27-
private Nette\Database\Context $database;
27+
private Nette\Database\Explorer $database;
2828

2929
private Passwords $passwords;
3030

3131

32-
public function __construct(Nette\Database\Context $database, Passwords $passwords)
32+
public function __construct(Nette\Database\Explorer $database, Passwords $passwords)
3333
{
3434
$this->database = $database;
3535
$this->passwords = $passwords;
@@ -40,7 +40,7 @@ public function __construct(Nette\Database\Context $database, Passwords $passwor
4040
* Performs an authentication.
4141
* @throws Nette\Security\AuthenticationException
4242
*/
43-
public function authenticate(array $credentials): Nette\Security\IIdentity
43+
public function authenticate(array $credentials): Nette\Security\SimpleIdentity
4444
{
4545
[$username, $password] = $credentials;
4646

@@ -62,7 +62,7 @@ public function authenticate(array $credentials): Nette\Security\IIdentity
6262

6363
$arr = $row->toArray();
6464
unset($arr[self::COLUMN_PASSWORD_HASH]);
65-
return new Nette\Security\Identity($row[self::COLUMN_ID], $row[self::COLUMN_ROLE], $arr);
65+
return new Nette\Security\SimpleIdentity($row[self::COLUMN_ID], $row[self::COLUMN_ROLE], $arr);
6666
}
6767

6868

app/config/common.neon

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ services:
2828
- App\Forms\FormFactory
2929
- App\Forms\SignInFormFactory
3030
- App\Forms\SignUpFormFactory
31-
router: App\Router\RouterFactory::createRouter
31+
- App\Router\RouterFactory::createRouter

0 commit comments

Comments
 (0)