Přidáno šifrování.
parent
1dcf6c5447
commit
f935a8a905
|
|
@ -68,6 +68,8 @@ final class MujAutentifikator implements Nette\Security\Authenticator
|
|||
$twoFactor = (bool) ($row?->IS_2FA_ENABLED ?? false);
|
||||
// secret 2FA:
|
||||
$secret = (string) ($row?->TOTP_SECRET ?? null);
|
||||
if (!empty($secret))
|
||||
$secret = Funkce::decrypt($secret); // je to šifra
|
||||
|
||||
// vrátíme naši třídu UserIdentity - ta se přilepí k Userovi.
|
||||
return new UserIdentity(
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Model;
|
||||
|
||||
use App\Core\Funkce;
|
||||
use Nette;
|
||||
use Nette\Security\User;
|
||||
use App\Model\Login\UserIdentity;
|
||||
|
|
@ -34,7 +35,7 @@ final class UzivatelFacade
|
|||
$this->database->table('UZIVATEL')
|
||||
->get($identity->getId())
|
||||
->update([
|
||||
'TOTP_SECRET' => $secret,
|
||||
'TOTP_SECRET' => Funkce::encrypt($secret), // šifrujeme
|
||||
'IS_2FA_ENABLED' => 1
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ use Nette\Application\Attributes\Persistent;
|
|||
use Nette\Http\Session;
|
||||
use Nette\Http\SessionSection;
|
||||
use App\Model\Login\UserIdentity;
|
||||
use App\Core\Funkce;
|
||||
|
||||
final class SignPresenter extends Nette\Application\UI\Presenter
|
||||
{
|
||||
|
|
@ -34,6 +35,9 @@ final class SignPresenter extends Nette\Application\UI\Presenter
|
|||
|
||||
protected function createComponentSignInForm(): Form
|
||||
{
|
||||
$sifra = Funkce::encrypt("KFMUYZL5VHCV3P5ZVFIMMPQAAN2D6ZRPBRAVATSQITDRGRKIO7P4IA3DCHLETVCMT3Y7RTXVIULC4JJSKX2JBC33XT52TLKFFPQAVAI");
|
||||
bdump($sifra);
|
||||
|
||||
$form = new Form();
|
||||
$form->addText('username', 'Uživatelské jméno:')
|
||||
->setRequired('Prosím vyplňte své uživatelské jméno.')
|
||||
|
|
|
|||
Loading…
Reference in New Issue