diff --git a/application/.env.dist b/application/.env.dist index 932879f..632c6cb 100644 --- a/application/.env.dist +++ b/application/.env.dist @@ -21,4 +21,8 @@ APP_SECRET=997425e20bc2144c301a312511101613 # For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode=" # Delivery is disabled by default via "null://localhost" MAILER_URL=null://localhost -###< symfony/swiftmailer-bundle ### + +###> friendsofsymfony/user-bundle ### +MAILER_SENDER=test@test.de +MAILER_USER=user +###< friendsofsymfony/user-bundle ### diff --git a/application/composer.json b/application/composer.json index 803b2ea..f8ed395 100644 --- a/application/composer.json +++ b/application/composer.json @@ -5,6 +5,7 @@ "php": "^7.1.3", "ext-ctype": "*", "ext-iconv": "*", + "friendsofsymfony/user-bundle": "~2.1", "knplabs/knp-menu-bundle": "^2.0", "sensio/framework-extra-bundle": "^5.1", "symfony/asset": "*", diff --git a/application/composer.lock b/application/composer.lock index 7026bef..b5b5a80 100644 --- a/application/composer.lock +++ b/application/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "46e513d742140ba387e272208c8a9dc9", + "content-hash": "49bb78c3c5e9cebe665f0e40f98e14b8", "packages": [ { "name": "doctrine/annotations", @@ -1281,6 +1281,82 @@ ], "time": "2016-10-17T18:31:11+00:00" }, + { + "name": "friendsofsymfony/user-bundle", + "version": "v2.1.2", + "source": { + "type": "git", + "url": "https://github.com/FriendsOfSymfony/FOSUserBundle.git", + "reference": "1049935edd24ec305cc6cfde1875372fa9600446" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/FriendsOfSymfony/FOSUserBundle/zipball/1049935edd24ec305cc6cfde1875372fa9600446", + "reference": "1049935edd24ec305cc6cfde1875372fa9600446", + "shasum": "" + }, + "require": { + "paragonie/random_compat": "^1 || ^2", + "php": "^5.5.9 || ^7.0", + "symfony/form": "^2.8 || ^3.0 || ^4.0", + "symfony/framework-bundle": "^2.8 || ^3.0 || ^4.0", + "symfony/security-bundle": "^2.8 || ^3.0 || ^4.0", + "symfony/templating": "^2.8 || ^3.0 || ^4.0", + "symfony/twig-bundle": "^2.8 || ^3.0 || ^4.0", + "symfony/validator": "^2.8 || ^3.0 || ^4.0", + "twig/twig": "^1.28 || ^2.0" + }, + "conflict": { + "doctrine/doctrine-bundle": "<1.3", + "symfony/doctrine-bridge": "<2.7" + }, + "require-dev": { + "doctrine/doctrine-bundle": "^1.3", + "friendsofphp/php-cs-fixer": "^2.2", + "phpunit/phpunit": "^4.8.35|^5.7.11|^6.5", + "swiftmailer/swiftmailer": "^4.3 || ^5.0 || ^6.0", + "symfony/console": "^2.8 || ^3.0 || ^4.0", + "symfony/phpunit-bridge": "^2.8 || ^3.0 || ^4.0", + "symfony/yaml": "^2.8 || ^3.0 || ^4.0" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "FOS\\UserBundle\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christophe Coevoet", + "email": "stof@notk.org" + }, + { + "name": "FriendsOfSymfony Community", + "homepage": "https://github.com/friendsofsymfony/FOSUserBundle/contributors" + }, + { + "name": "Thibault Duplessis" + } + ], + "description": "Symfony FOSUserBundle", + "homepage": "http://friendsofsymfony.github.com", + "keywords": [ + "User management" + ], + "time": "2018-03-08T08:59:27+00:00" + }, { "name": "jdorn/sql-formatter", "version": "v1.2.17", @@ -4292,6 +4368,62 @@ "homepage": "http://symfony.com", "time": "2018-08-29T08:49:17+00:00" }, + { + "name": "symfony/templating", + "version": "v4.1.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/templating.git", + "reference": "411b8c324ee3e8b36e71d938e8d043d6e16582d2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/templating/zipball/411b8c324ee3e8b36e71d938e8d043d6e16582d2", + "reference": "411b8c324ee3e8b36e71d938e8d043d6e16582d2", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/polyfill-ctype": "~1.8" + }, + "require-dev": { + "psr/log": "~1.0" + }, + "suggest": { + "psr/log-implementation": "For using debug logging in loaders" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Templating\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Templating Component", + "homepage": "https://symfony.com", + "time": "2018-07-26T11:24:31+00:00" + }, { "name": "symfony/translation", "version": "v4.1.4", diff --git a/application/config/bundles.php b/application/config/bundles.php index 6e2c04e..55d087c 100644 --- a/application/config/bundles.php +++ b/application/config/bundles.php @@ -15,4 +15,5 @@ return [ Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], Symfony\Bundle\WebServerBundle\WebServerBundle::class => ['dev' => true], Knp\Bundle\MenuBundle\KnpMenuBundle::class => ['all' => true], + FOS\UserBundle\FOSUserBundle::class => ['all' => true], ]; diff --git a/application/config/packages/fos_user.yaml b/application/config/packages/fos_user.yaml new file mode 100644 index 0000000..5dd980e --- /dev/null +++ b/application/config/packages/fos_user.yaml @@ -0,0 +1,7 @@ +fos_user: + db_driver: orm # other valid values are 'mongodb' and 'couchdb' + firewall_name: main + user_class: App\Entity\User + from_email: + address: "%env(MAILER_SENDER)%" + sender_name: "%env(MAILER_USER)%" diff --git a/application/config/packages/framework.yaml b/application/config/packages/framework.yaml index 8b24418..2ae47b9 100644 --- a/application/config/packages/framework.yaml +++ b/application/config/packages/framework.yaml @@ -28,3 +28,5 @@ framework: # APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues) #app: cache.adapter.apcu + templating: + engines: ['twig', 'php'] diff --git a/application/config/packages/security.yaml b/application/config/packages/security.yaml index 325e31e..5aaeaed 100644 --- a/application/config/packages/security.yaml +++ b/application/config/packages/security.yaml @@ -1,13 +1,13 @@ security: # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers encoders: - App\Entity\User: - algorithm: bcrypt + FOS\UserBundle\Model\UserInterface: bcrypt providers: - our_db_provider: - entity: - class: App\Entity\User - property: username + fos_userbundle: + id: fos_user.user_provider.username + role_hierarchy: + ROLE_ADMIN: ROLE_USER + ROLE_SUPER_ADMIN: ROLE_ADMIN hide_user_not_found: false firewalls: dev: @@ -16,21 +16,18 @@ security: main: anonymous: true form_login: - login_path: login - check_path: login - logout: - path: /logout - target: / + provider: fos_userbundle + csrf_token_generator: security.csrf.token_manager + logout: true + # activate different ways to authenticate # http_basic: true # https://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate - - # form_login: true - # https://symfony.com/doc/current/security/form_login_setup.html - # Easy way to control access for large sections of your site # Note: Only the *first* access control that matches will be used access_control: - # - { path: ^/admin, roles: ROLE_ADMIN } - # - { path: ^/profile, roles: ROLE_USER } + - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: ^/admin/, role: ROLE_ADMIN } diff --git a/application/config/routes.yaml b/application/config/routes.yaml index aa7239c..ad570d2 100644 --- a/application/config/routes.yaml +++ b/application/config/routes.yaml @@ -1,2 +1,4 @@ logout: path: /logout +fos_user: + resource: "@FOSUserBundle/Resources/config/routing/all.xml" diff --git a/application/src/Controller/RegistrationController.php b/application/src/Controller/RegistrationController.php deleted file mode 100644 index cabcf7c..0000000 --- a/application/src/Controller/RegistrationController.php +++ /dev/null @@ -1,61 +0,0 @@ -user = new User(); - $form = $this->createForm(UserType::class, $this->user); - $form->handleRequest($request); - 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() - )); - } - - public function encodePassword(UserPasswordEncoderInterface $passwordEncoder): void - { - $password = $passwordEncoder->encodePassword($this->user, $this->user->getPlainPassword()); - $this->user->setPassword($password); - } - - private function saveUser(TranslatorInterface $translator): void - { - $entityManager = $this->getDoctrine()->getManager(); - $entityManager->persist($this->user); - try { - $entityManager->flush(); - $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()])); - } - } -} - diff --git a/application/src/Controller/SecurityController.php b/application/src/Controller/SecurityController.php deleted file mode 100644 index 67ab0a4..0000000 --- a/application/src/Controller/SecurityController.php +++ /dev/null @@ -1,37 +0,0 @@ -getLastAuthenticationError(); - if ($error) { - $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])); - } - } - return $this->render("user/login.html.twig",[ - 'last_username'=>$authenticationUtils->getLastUsername(), - ]); - } -} - diff --git a/application/src/Entity/Attribut/IdAttribut.php b/application/src/Entity/Attribut/IdAttribut.php index 2e31319..f1e47a9 100644 --- a/application/src/Entity/Attribut/IdAttribut.php +++ b/application/src/Entity/Attribut/IdAttribut.php @@ -1,6 +1,8 @@ id = $id; + } + + public function getId(): int + { + return $this->id; + } public function __construct() { + parent::__construct (); + /** + * @todo Remove this later + * @var \App\Entity\User $isActive + */ $this->isActive = true; } - - public function getSalt() - { - return null; - } - - public function getRoles() - { - return array('ROLE_USER'); - } - - public function eraseCredentials() - { - } - - /** @see \Serializable::serialize() */ - public function serialize() - { - return serialize(array( - $this->id, - $this->username, - $this->password, - )); - } - - /** @see \Serializable::unserialize() */ - public function unserialize($serialized) - { - list ( - $this->id, - $this->username, - $this->password, - ) = unserialize($serialized, array('allowed_classes' => false)); - } } diff --git a/application/src/Entity/UserInterface.php b/application/src/Entity/UserInterface.php deleted file mode 100644 index e5e99dc..0000000 --- a/application/src/Entity/UserInterface.php +++ /dev/null @@ -1,14 +0,0 @@ - + + +{{ form_end(form) }} diff --git a/application/src/Resources/FOSUserBundle/views/Group/edit.html.twig b/application/src/Resources/FOSUserBundle/views/Group/edit.html.twig new file mode 100644 index 0000000..f1caa9f --- /dev/null +++ b/application/src/Resources/FOSUserBundle/views/Group/edit.html.twig @@ -0,0 +1,5 @@ +{% extends "@FOSUser/layout.html.twig" %} + +{% block fos_user_content %} +{% include "@FOSUser/Group/edit_content.html.twig" %} +{% endblock fos_user_content %} diff --git a/application/src/Resources/FOSUserBundle/views/Group/edit_content.html.twig b/application/src/Resources/FOSUserBundle/views/Group/edit_content.html.twig new file mode 100644 index 0000000..5fcce27 --- /dev/null +++ b/application/src/Resources/FOSUserBundle/views/Group/edit_content.html.twig @@ -0,0 +1,8 @@ +{% trans_default_domain 'FOSUserBundle' %} + +{{ form_start(form, { 'action': path('fos_user_group_edit', {'groupName': group_name}), 'attr': { 'class': 'fos_user_group_edit' } }) }} + {{ form_widget(form) }} +
+ +
+{{ form_end(form) }} diff --git a/application/src/Resources/FOSUserBundle/views/Group/list.html.twig b/application/src/Resources/FOSUserBundle/views/Group/list.html.twig new file mode 100644 index 0000000..9371b1b --- /dev/null +++ b/application/src/Resources/FOSUserBundle/views/Group/list.html.twig @@ -0,0 +1,5 @@ +{% extends "@FOSUser/layout.html.twig" %} + +{% block fos_user_content %} +{% include "@FOSUser/Group/list_content.html.twig" %} +{% endblock fos_user_content %} diff --git a/application/src/Resources/FOSUserBundle/views/Group/list_content.html.twig b/application/src/Resources/FOSUserBundle/views/Group/list_content.html.twig new file mode 100644 index 0000000..04f09c0 --- /dev/null +++ b/application/src/Resources/FOSUserBundle/views/Group/list_content.html.twig @@ -0,0 +1,7 @@ +
+ +
diff --git a/application/src/Resources/FOSUserBundle/views/Group/new.html.twig b/application/src/Resources/FOSUserBundle/views/Group/new.html.twig new file mode 100644 index 0000000..93c4fd9 --- /dev/null +++ b/application/src/Resources/FOSUserBundle/views/Group/new.html.twig @@ -0,0 +1,5 @@ +{% extends "@FOSUser/layout.html.twig" %} + +{% block fos_user_content %} +{% include "@FOSUser/Group/new_content.html.twig" %} +{% endblock fos_user_content %} diff --git a/application/src/Resources/FOSUserBundle/views/Group/new_content.html.twig b/application/src/Resources/FOSUserBundle/views/Group/new_content.html.twig new file mode 100644 index 0000000..20d0e67 --- /dev/null +++ b/application/src/Resources/FOSUserBundle/views/Group/new_content.html.twig @@ -0,0 +1,8 @@ +{% trans_default_domain 'FOSUserBundle' %} + +{{ form_start(form, { 'action': path('fos_user_group_new'), 'attr': { 'class': 'fos_user_group_new' } }) }} + {{ form_widget(form) }} +
+ +
+{{ form_end(form) }} diff --git a/application/src/Resources/FOSUserBundle/views/Group/show.html.twig b/application/src/Resources/FOSUserBundle/views/Group/show.html.twig new file mode 100644 index 0000000..f63136e --- /dev/null +++ b/application/src/Resources/FOSUserBundle/views/Group/show.html.twig @@ -0,0 +1,5 @@ +{% extends "@FOSUser/layout.html.twig" %} + +{% block fos_user_content %} +{% include "@FOSUser/Group/show_content.html.twig" %} +{% endblock fos_user_content %} diff --git a/application/src/Resources/FOSUserBundle/views/Group/show_content.html.twig b/application/src/Resources/FOSUserBundle/views/Group/show_content.html.twig new file mode 100644 index 0000000..528b021 --- /dev/null +++ b/application/src/Resources/FOSUserBundle/views/Group/show_content.html.twig @@ -0,0 +1,5 @@ +{% trans_default_domain 'FOSUserBundle' %} + +
+

{{ 'group.show.name'|trans }}: {{ group.getName() }}

+
diff --git a/application/src/Resources/FOSUserBundle/views/Profile/edit.html.twig b/application/src/Resources/FOSUserBundle/views/Profile/edit.html.twig new file mode 100644 index 0000000..bd7fbdc --- /dev/null +++ b/application/src/Resources/FOSUserBundle/views/Profile/edit.html.twig @@ -0,0 +1,5 @@ +{% extends "@FOSUser/layout.html.twig" %} + +{% block fos_user_content %} +{% include "@FOSUser/Profile/edit_content.html.twig" %} +{% endblock fos_user_content %} diff --git a/application/src/Resources/FOSUserBundle/views/Profile/edit_content.html.twig b/application/src/Resources/FOSUserBundle/views/Profile/edit_content.html.twig new file mode 100644 index 0000000..c827436 --- /dev/null +++ b/application/src/Resources/FOSUserBundle/views/Profile/edit_content.html.twig @@ -0,0 +1,8 @@ +{% trans_default_domain 'FOSUserBundle' %} + +{{ form_start(form, { 'action': path('fos_user_profile_edit'), 'attr': { 'class': 'fos_user_profile_edit' } }) }} + {{ form_widget(form) }} +
+ +
+{{ form_end(form) }} diff --git a/application/src/Resources/FOSUserBundle/views/Profile/show.html.twig b/application/src/Resources/FOSUserBundle/views/Profile/show.html.twig new file mode 100644 index 0000000..1e4a259 --- /dev/null +++ b/application/src/Resources/FOSUserBundle/views/Profile/show.html.twig @@ -0,0 +1,5 @@ +{% extends "@FOSUser/layout.html.twig" %} + +{% block fos_user_content %} +{% include "@FOSUser/Profile/show_content.html.twig" %} +{% endblock fos_user_content %} diff --git a/application/src/Resources/FOSUserBundle/views/Profile/show_content.html.twig b/application/src/Resources/FOSUserBundle/views/Profile/show_content.html.twig new file mode 100644 index 0000000..3c819d2 --- /dev/null +++ b/application/src/Resources/FOSUserBundle/views/Profile/show_content.html.twig @@ -0,0 +1,6 @@ +{% trans_default_domain 'FOSUserBundle' %} + +
+

{{ 'profile.show.username'|trans }}: {{ user.username }}

+

{{ 'profile.show.email'|trans }}: {{ user.email }}

+
diff --git a/application/src/Resources/FOSUserBundle/views/Registration/check_email.html.twig b/application/src/Resources/FOSUserBundle/views/Registration/check_email.html.twig new file mode 100644 index 0000000..41af21d --- /dev/null +++ b/application/src/Resources/FOSUserBundle/views/Registration/check_email.html.twig @@ -0,0 +1,7 @@ +{% extends "@FOSUser/layout.html.twig" %} + +{% trans_default_domain 'FOSUserBundle' %} + +{% block fos_user_content %} +

{{ 'registration.check_email'|trans({'%email%': user.email}) }}

+{% endblock fos_user_content %} diff --git a/application/src/Resources/FOSUserBundle/views/Registration/confirmed.html.twig b/application/src/Resources/FOSUserBundle/views/Registration/confirmed.html.twig new file mode 100644 index 0000000..4402b4f --- /dev/null +++ b/application/src/Resources/FOSUserBundle/views/Registration/confirmed.html.twig @@ -0,0 +1,10 @@ +{% extends "@FOSUser/layout.html.twig" %} + +{% trans_default_domain 'FOSUserBundle' %} + +{% block fos_user_content %} +

{{ 'registration.confirmed'|trans({'%username%': user.username}) }}

+ {% if targetUrl %} +

{{ 'registration.back'|trans }}

+ {% endif %} +{% endblock fos_user_content %} diff --git a/application/src/Resources/FOSUserBundle/views/Registration/email.txt.twig b/application/src/Resources/FOSUserBundle/views/Registration/email.txt.twig new file mode 100644 index 0000000..acbc685 --- /dev/null +++ b/application/src/Resources/FOSUserBundle/views/Registration/email.txt.twig @@ -0,0 +1,13 @@ +{% trans_default_domain 'FOSUserBundle' %} +{% block subject %} +{%- autoescape false -%} +{{ 'registration.email.subject'|trans({'%username%': user.username, '%confirmationUrl%': confirmationUrl}) }} +{%- endautoescape -%} +{% endblock %} + +{% block body_text %} +{% autoescape false %} +{{ 'registration.email.message'|trans({'%username%': user.username, '%confirmationUrl%': confirmationUrl}) }} +{% endautoescape %} +{% endblock %} +{% block body_html %}{% endblock %} diff --git a/application/src/Resources/FOSUserBundle/views/Registration/register.html.twig b/application/src/Resources/FOSUserBundle/views/Registration/register.html.twig new file mode 100644 index 0000000..92b6878 --- /dev/null +++ b/application/src/Resources/FOSUserBundle/views/Registration/register.html.twig @@ -0,0 +1,5 @@ +{% extends "@FOSUser/layout.html.twig" %} + +{% block fos_user_content %} +{% include "@FOSUser/Registration/register_content.html.twig" %} +{% endblock fos_user_content %} diff --git a/application/src/Resources/FOSUserBundle/views/Registration/register_content.html.twig b/application/src/Resources/FOSUserBundle/views/Registration/register_content.html.twig new file mode 100644 index 0000000..ecedeb9 --- /dev/null +++ b/application/src/Resources/FOSUserBundle/views/Registration/register_content.html.twig @@ -0,0 +1,8 @@ +{% trans_default_domain 'FOSUserBundle' %} + +{{ form_start(form, {'method': 'post', 'action': path('fos_user_registration_register'), 'attr': {'class': 'fos_user_registration_register'}}) }} + {{ form_widget(form) }} +
+ +
+{{ form_end(form) }} diff --git a/application/src/Resources/FOSUserBundle/views/Resetting/check_email.html.twig b/application/src/Resources/FOSUserBundle/views/Resetting/check_email.html.twig new file mode 100644 index 0000000..1b589f7 --- /dev/null +++ b/application/src/Resources/FOSUserBundle/views/Resetting/check_email.html.twig @@ -0,0 +1,9 @@ +{% extends "@FOSUser/layout.html.twig" %} + +{% trans_default_domain 'FOSUserBundle' %} + +{% block fos_user_content %} +

+{{ 'resetting.check_email'|trans({'%tokenLifetime%': tokenLifetime})|nl2br }} +

+{% endblock %} diff --git a/application/src/Resources/FOSUserBundle/views/Resetting/email.txt.twig b/application/src/Resources/FOSUserBundle/views/Resetting/email.txt.twig new file mode 100644 index 0000000..bd52c9e --- /dev/null +++ b/application/src/Resources/FOSUserBundle/views/Resetting/email.txt.twig @@ -0,0 +1,13 @@ +{% trans_default_domain 'FOSUserBundle' %} +{% block subject %} +{%- autoescape false -%} +{{ 'resetting.email.subject'|trans({'%username%': user.username}) }} +{%- endautoescape -%} +{% endblock %} + +{% block body_text %} +{% autoescape false %} +{{ 'resetting.email.message'|trans({'%username%': user.username, '%confirmationUrl%': confirmationUrl}) }} +{% endautoescape %} +{% endblock %} +{% block body_html %}{% endblock %} diff --git a/application/src/Resources/FOSUserBundle/views/Resetting/request.html.twig b/application/src/Resources/FOSUserBundle/views/Resetting/request.html.twig new file mode 100644 index 0000000..87e7b41 --- /dev/null +++ b/application/src/Resources/FOSUserBundle/views/Resetting/request.html.twig @@ -0,0 +1,5 @@ +{% extends "@FOSUser/layout.html.twig" %} + +{% block fos_user_content %} +{% include "@FOSUser/Resetting/request_content.html.twig" %} +{% endblock fos_user_content %} diff --git a/application/src/Resources/FOSUserBundle/views/Resetting/request_content.html.twig b/application/src/Resources/FOSUserBundle/views/Resetting/request_content.html.twig new file mode 100644 index 0000000..3d1211b --- /dev/null +++ b/application/src/Resources/FOSUserBundle/views/Resetting/request_content.html.twig @@ -0,0 +1,11 @@ +{% trans_default_domain 'FOSUserBundle' %} + +
+
+ + +
+
+ +
+
diff --git a/application/src/Resources/FOSUserBundle/views/Resetting/reset.html.twig b/application/src/Resources/FOSUserBundle/views/Resetting/reset.html.twig new file mode 100644 index 0000000..fab676a --- /dev/null +++ b/application/src/Resources/FOSUserBundle/views/Resetting/reset.html.twig @@ -0,0 +1,5 @@ +{% extends "@FOSUser/layout.html.twig" %} + +{% block fos_user_content %} +{% include "@FOSUser/Resetting/reset_content.html.twig" %} +{% endblock fos_user_content %} diff --git a/application/src/Resources/FOSUserBundle/views/Resetting/reset_content.html.twig b/application/src/Resources/FOSUserBundle/views/Resetting/reset_content.html.twig new file mode 100644 index 0000000..d8b0c4d --- /dev/null +++ b/application/src/Resources/FOSUserBundle/views/Resetting/reset_content.html.twig @@ -0,0 +1,8 @@ +{% trans_default_domain 'FOSUserBundle' %} + +{{ form_start(form, { 'action': path('fos_user_resetting_reset', {'token': token}), 'attr': { 'class': 'fos_user_resetting_reset' } }) }} + {{ form_widget(form) }} +
+ +
+{{ form_end(form) }} diff --git a/application/src/Resources/FOSUserBundle/views/Security/login.html.twig b/application/src/Resources/FOSUserBundle/views/Security/login.html.twig new file mode 100644 index 0000000..af763c7 --- /dev/null +++ b/application/src/Resources/FOSUserBundle/views/Security/login.html.twig @@ -0,0 +1,10 @@ +{% extends "@FOSUser/layout.html.twig" %} +{% block title %} +{% trans %}login{% endtrans %} +{% endblock %} +{% block content %} +

+ {% trans %}login{% endtrans %} +

+{{ include('@FOSUser/Security/login_content.html.twig') }} +{% endblock %} diff --git a/application/src/Resources/FOSUserBundle/views/Security/login_content.html.twig b/application/src/Resources/FOSUserBundle/views/Security/login_content.html.twig new file mode 100644 index 0000000..d812bd5 --- /dev/null +++ b/application/src/Resources/FOSUserBundle/views/Security/login_content.html.twig @@ -0,0 +1,27 @@ +{% trans_default_domain 'FOSUserBundle' %} +{% if error %} + {% include "frames/structure/message/message.html.twig" with {'message':error.messageKey|trans(error.messageData, 'security'),'label':'danger'} %} +{% endif %} + +
+ {% if csrf_token %} + + {% endif %} +
+ +
+
+ +
+
+ + +
+ +
\ No newline at end of file diff --git a/application/src/Resources/FOSUserBundle/views/layout.html.twig b/application/src/Resources/FOSUserBundle/views/layout.html.twig new file mode 100644 index 0000000..01f4044 --- /dev/null +++ b/application/src/Resources/FOSUserBundle/views/layout.html.twig @@ -0,0 +1,28 @@ + +{% extends "frames/default.html.twig" %} +{% block content %} +
+ {% if is_granted("IS_AUTHENTICATED_REMEMBERED") %} + {{ 'layout.logged_in_as'|trans({'%username%': app.user.username}, 'FOSUserBundle') }} + | {{ 'layout.logout'|trans({}, 'FOSUserBundle') }} + + {% else %} + {{ 'layout.login'|trans({}, 'FOSUserBundle') }} + {% endif %} +
+ +{% if app.request.hasPreviousSession %} +{% for type, messages in app.session.flashbag.all() %} +{% for message in messages %} +
+ {{ message }} +
+{% endfor %} +{% endfor %} +{% endif %} + +
+ {% block fos_user_content %} + {% endblock fos_user_content %} +
+{% endblock content %} diff --git a/application/src/Subscriber/UserMenuSubscriber.php b/application/src/Subscriber/UserMenuSubscriber.php index 8e901b4..832ae7c 100644 --- a/application/src/Subscriber/UserMenuSubscriber.php +++ b/application/src/Subscriber/UserMenuSubscriber.php @@ -63,7 +63,7 @@ class UserMenuSubscriber implements EventSubscriberInterface ]); } else { $dropdown->addChild('login', [ - 'route' => 'login', + 'route' => 'fos_user_security_login', 'attributes' => [ 'divider_append' => true, 'icon' => 'fas fa-sign-in-alt' @@ -71,7 +71,7 @@ class UserMenuSubscriber implements EventSubscriberInterface ]); } $dropdown->addChild('register', [ - 'route' => 'user_register', + 'route' => 'fos_user_registration_register', 'attributes' => [ 'icon' => 'fas fa-file-signature' ] diff --git a/application/symfony.lock b/application/symfony.lock index 7fd2dbe..43a223d 100644 --- a/application/symfony.lock +++ b/application/symfony.lock @@ -80,6 +80,9 @@ "fig/link-util": { "version": "1.0.0" }, + "friendsofsymfony/user-bundle": { + "version": "v2.1.2" + }, "jdorn/sql-formatter": { "version": "v1.2.17" }, @@ -395,6 +398,9 @@ "ref": "3db029c03e452b4a23f7fc45cec7c922c2247eb8" } }, + "symfony/templating": { + "version": "v4.1.4" + }, "symfony/test-pack": { "version": "v1.0.2" }, diff --git a/application/templates/frames/structure/message/flash_messages.html.twig b/application/templates/frames/structure/message/flash_messages.html.twig index 08f35fe..2825b6b 100644 --- a/application/templates/frames/structure/message/flash_messages.html.twig +++ b/application/templates/frames/structure/message/flash_messages.html.twig @@ -1,8 +1,5 @@ -{% set icons = {'success':'fas fa-check-circle','danger':'fas fa-times','warning':'fas fa-exclamation-triangle','info':'fas fa-info'} %} {% for label,messages in app.flashes %} {% for message in messages %} -
- {{ message }} -
+{% include "frames/structure/message/message.html.twig" with {'message':message,'label':label} %} {% endfor %} {% endfor %} \ No newline at end of file diff --git a/application/templates/frames/structure/message/message.html.twig b/application/templates/frames/structure/message/message.html.twig new file mode 100644 index 0000000..2b44df5 --- /dev/null +++ b/application/templates/frames/structure/message/message.html.twig @@ -0,0 +1,4 @@ +{% set icons = {'success':'fas fa-check-circle','danger':'fas fa-times','warning':'fas fa-exclamation-triangle','info':'fas fa-info'} %} +
+ {{ message }} +
\ No newline at end of file diff --git a/application/templates/user/login.html.twig b/application/templates/user/login.html.twig deleted file mode 100644 index bc69851..0000000 --- a/application/templates/user/login.html.twig +++ /dev/null @@ -1,25 +0,0 @@ -{% extends "frames/default.html.twig" %} -{% block title %} -{% trans %}login{% endtrans %} -{% endblock %} -{% block content %} -

- {% trans %}login{% endtrans %} -

-
-
- -
-
- -
- -
-{% endblock %}