mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 21:57:16 +02:00
Format code
This commit is contained in:
@@ -1,17 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
interface ActivationInterface
|
||||
{
|
||||
public function deactivate():Response;
|
||||
|
||||
public function activate():Response;
|
||||
}
|
||||
public function deactivate(): Response;
|
||||
|
||||
public function activate(): Response;
|
||||
}
|
||||
|
@@ -1,17 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
interface CreationInterface
|
||||
{
|
||||
public function create():Response;
|
||||
|
||||
public function delete():Response;
|
||||
}
|
||||
public function create(): Response;
|
||||
|
||||
public function delete(): Response;
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
@@ -6,9 +7,7 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
class DefaultController extends AbstractController implements DefaultControllerInterface
|
||||
{
|
||||
@@ -17,15 +16,14 @@ class DefaultController extends AbstractController implements DefaultControllerI
|
||||
*/
|
||||
public function imprint(): Response
|
||||
{
|
||||
return $this->render("standard/imprint.html.twig");
|
||||
return $this->render('standard/imprint.html.twig');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Route("/", name="homepage")
|
||||
*/
|
||||
public function homepage(): Response
|
||||
{
|
||||
return $this->render("standard/homepage.html.twig");
|
||||
return $this->render('standard/homepage.html.twig');
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,17 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
interface DefaultControllerInterface
|
||||
{
|
||||
public function homepage():Response;
|
||||
|
||||
public function imprint():Response;
|
||||
}
|
||||
public function homepage(): Response;
|
||||
|
||||
public function imprint(): Response;
|
||||
}
|
||||
|
@@ -1,15 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
interface ModificationInterface
|
||||
{
|
||||
public function modify(int $id):Response;
|
||||
public function modify(int $id): Response;
|
||||
}
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Form\UserType;
|
||||
@@ -7,25 +8,20 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
|
||||
class RegistrationController extends AbstractController
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var User
|
||||
*/
|
||||
private $user;
|
||||
|
||||
/**
|
||||
*
|
||||
* @Route("/register", name="user_register")
|
||||
*/
|
||||
public function register(Request $request, UserPasswordEncoderInterface $passwordEncoder,TranslatorInterface $translator): Response
|
||||
public function register(Request $request, UserPasswordEncoderInterface $passwordEncoder, TranslatorInterface $translator): Response
|
||||
{
|
||||
$this->user = new User();
|
||||
$form = $this->createForm(UserType::class, $this->user);
|
||||
@@ -33,11 +29,13 @@ class RegistrationController extends AbstractController
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$this->encodePassword($passwordEncoder);
|
||||
$this->saveUser($translator);
|
||||
|
||||
return $this->redirectToRoute('login');
|
||||
}
|
||||
return $this->render("user/register.html.twig", array(
|
||||
'form' => $form->createView()
|
||||
));
|
||||
|
||||
return $this->render('user/register.html.twig', [
|
||||
'form' => $form->createView(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function encodePassword(UserPasswordEncoderInterface $passwordEncoder): void
|
||||
@@ -52,10 +50,9 @@ class RegistrationController extends AbstractController
|
||||
$entityManager->persist($this->user);
|
||||
try {
|
||||
$entityManager->flush();
|
||||
$this->addFlash('success', $translator->trans('User "%username%" created!',['%username%'=>$this->user->getUsername()]));
|
||||
$this->addFlash('success', $translator->trans('User "%username%" created!', ['%username%' => $this->user->getUsername()]));
|
||||
} catch (\Exception $exception) {
|
||||
$this->addFlash('danger', $translator->trans('User "%username%" could not be created!',['%username%'=>$this->user->getUsername()]));
|
||||
$this->addFlash('danger', $translator->trans('User "%username%" could not be created!', ['%username%' => $this->user->getUsername()]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
|
||||
@@ -8,30 +9,27 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
class SecurityController extends AbstractController
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @Route("/login", name="login")
|
||||
*/
|
||||
public function login(AuthenticationUtils $authenticationUtils,TranslatorInterface $translator): Response
|
||||
public function login(AuthenticationUtils $authenticationUtils, TranslatorInterface $translator): Response
|
||||
{
|
||||
$error = $authenticationUtils->getLastAuthenticationError();
|
||||
if ($error) {
|
||||
$this->addFlash('danger', $translator->trans($error->getMessageKey(),$error->getMessageData(),'security'));
|
||||
}else{
|
||||
$this->addFlash('danger', $translator->trans($error->getMessageKey(), $error->getMessageData(), 'security'));
|
||||
} else {
|
||||
$lastUsername = $authenticationUtils->getLastUsername();
|
||||
if($lastUsername){
|
||||
$this->addFlash('success', $translator->trans('User %user% loged in.',['%user%'=>$lastUsername]));
|
||||
if ($lastUsername) {
|
||||
$this->addFlash('success', $translator->trans('User %user% loged in.', ['%user%' => $lastUsername]));
|
||||
}
|
||||
}
|
||||
return $this->render("user/login.html.twig",[
|
||||
'last_username'=>$authenticationUtils->getLastUsername(),
|
||||
|
||||
return $this->render('user/login.html.twig', [
|
||||
'last_username' => $authenticationUtils->getLastUsername(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,32 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
class SourceController implements SourceControllerInterface
|
||||
{
|
||||
public function modify(int $id): Response
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
public function show(int $id): Response
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
public function activate(): Response
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
public function create(): Response
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
public function delete(): Response
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
public function deactivate(): Response
|
||||
{}
|
||||
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,15 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
interface SourceControllerInterface extends CreationInterface, ActivationInterface, ModificationInterface
|
||||
{
|
||||
public function show(int $id):Response;
|
||||
public function show(int $id): Response;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user