first commit
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace KupShop\TwoFactorBundle\Controller;
|
||||
|
||||
use KupShop\KupShopBundle\Routing\TranslatedRoute;
|
||||
use KupShop\TwoFactorBundle\View\TwoFactorView;
|
||||
use KupShop\UserBundle\View\LoginView;
|
||||
use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface;
|
||||
use Scheb\TwoFactorBundle\Security\TwoFactor\Provider\Email\Generator\CodeGeneratorInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class TwoFactorController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @TranslatedRoute("/#2fa_check#/")
|
||||
*/
|
||||
public function twoFactorAction(TwoFactorView $view)
|
||||
{
|
||||
return $view->getResponse();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/2fa_resend")
|
||||
*/
|
||||
public function resendTwoFactorAction(CodeGeneratorInterface $codeGenerator, Security $security)
|
||||
{
|
||||
$user = $security->getUser();
|
||||
if ($user instanceof TwoFactorInterface) {
|
||||
$codeGenerator->reSend($user);
|
||||
}
|
||||
|
||||
return new RedirectResponse(path('2fa_login'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/login/check")
|
||||
*/
|
||||
public function checkAction(Request $request, LoginView $view)
|
||||
{
|
||||
$view->setRequest($request);
|
||||
|
||||
return $view->getResponse();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user