PHP code example of vojtech-dobes / nette-multi-authenticator
1. Go to this page and download the library: Download vojtech-dobes/nette-multi-authenticator library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
vojtech-dobes / nette-multi-authenticator example snippets
class CredentialsAuthenticator
{
/** @var Nette\Security\User */
private $user;
public function __construct(Nette\Security\User $user)
{
$this->user = $user;
}
}
public function login($username, $password)
{
// ... your logic
$this->user->login(new Identity( ... ));
}
class SignPresenter extends Nette\Application\UI\Presenter
{
/** @var CredentialsAuthenticator @inject */
public $credentialsAuthenticator;
// ...
public function processLoginForm($form)
{
$values = $form->getValues();
$this->credentialsAuthenticator->login($values->username, $values->password);
}
}