From 0a878469d4038c36c84d1dd707265d880fa342e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Sat, 3 Oct 2015 06:29:55 +0200 Subject: move some files to UserBundle --- .../CoreBundle/DataFixtures/ORM/LoadUserData.php | 50 ---------------- src/Wallabag/CoreBundle/Entity/Config.php | 2 +- src/Wallabag/CoreBundle/Entity/Entry.php | 2 +- src/Wallabag/CoreBundle/Entity/Tag.php | 2 +- .../RegistrationConfirmedListenerTest.php | 2 +- .../CoreBundle/Tests/WallabagCoreTestCase.php | 2 +- .../UserBundle/DataFixtures/ORM/LoadUserData.php | 50 ++++++++++++++++ .../Resources/views/Default/index.html.twig | 1 - .../material/Registration/register.html.twig | 32 ++++++++++ .../Registration/register_content.html.twig | 14 +++++ .../themes/material/Security/checkEmail.html.twig | 27 +++++++++ .../material/Security/forgotPassword.html.twig | 59 ++++++++++++++++++ .../views/themes/material/Security/login.html.twig | 69 ++++++++++++++++++++++ .../views/themes/material/Security/reset.html.twig | 57 ++++++++++++++++++ src/Wallabag/UserBundle/WallabagUserBundle.php | 4 ++ 15 files changed, 317 insertions(+), 56 deletions(-) delete mode 100644 src/Wallabag/CoreBundle/DataFixtures/ORM/LoadUserData.php create mode 100644 src/Wallabag/UserBundle/DataFixtures/ORM/LoadUserData.php delete mode 100644 src/Wallabag/UserBundle/Resources/views/Default/index.html.twig create mode 100644 src/Wallabag/UserBundle/Resources/views/themes/material/Registration/register.html.twig create mode 100644 src/Wallabag/UserBundle/Resources/views/themes/material/Registration/register_content.html.twig create mode 100644 src/Wallabag/UserBundle/Resources/views/themes/material/Security/checkEmail.html.twig create mode 100644 src/Wallabag/UserBundle/Resources/views/themes/material/Security/forgotPassword.html.twig create mode 100644 src/Wallabag/UserBundle/Resources/views/themes/material/Security/login.html.twig create mode 100644 src/Wallabag/UserBundle/Resources/views/themes/material/Security/reset.html.twig (limited to 'src') diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadUserData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadUserData.php deleted file mode 100644 index d48855da..00000000 --- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadUserData.php +++ /dev/null @@ -1,50 +0,0 @@ -setName('Big boss'); - $userAdmin->setEmail('bigboss@wallabag.org'); - $userAdmin->setUsername('admin'); - $userAdmin->setPlainPassword('mypassword'); - $userAdmin->setEnabled(true); - $userAdmin->addRole('ROLE_SUPER_ADMIN'); - - $manager->persist($userAdmin); - - $this->addReference('admin-user', $userAdmin); - - $bobUser = new User(); - $bobUser->setName('Bobby'); - $bobUser->setEmail('bobby@wallabag.org'); - $bobUser->setUsername('bob'); - $bobUser->setPlainPassword('mypassword'); - $bobUser->setEnabled(true); - - $manager->persist($bobUser); - - $this->addReference('bob-user', $bobUser); - - $manager->flush(); - } - - /** - * {@inheritdoc} - */ - public function getOrder() - { - return 10; - } -} diff --git a/src/Wallabag/CoreBundle/Entity/Config.php b/src/Wallabag/CoreBundle/Entity/Config.php index ddd4f7d9..2390bfe1 100644 --- a/src/Wallabag/CoreBundle/Entity/Config.php +++ b/src/Wallabag/CoreBundle/Entity/Config.php @@ -79,7 +79,7 @@ class Config /* * @param User $user */ - public function __construct(Wallabag\UserBundle\Entity\User $user) + public function __construct(\Wallabag\UserBundle\Entity\User $user) { $this->user = $user; } diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index f6206a09..4fd74001 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -143,7 +143,7 @@ class Entry /* * @param User $user */ - public function __construct(Wallabag\UserBundle\Entity\User $user) + public function __construct(\Wallabag\UserBundle\Entity\User $user) { $this->user = $user; $this->tags = new ArrayCollection(); diff --git a/src/Wallabag/CoreBundle/Entity/Tag.php b/src/Wallabag/CoreBundle/Entity/Tag.php index 6067360f..5b571823 100644 --- a/src/Wallabag/CoreBundle/Entity/Tag.php +++ b/src/Wallabag/CoreBundle/Entity/Tag.php @@ -46,7 +46,7 @@ class Tag */ private $user; - public function __construct(User $user) + public function __construct(\Wallabag\UserBundle\Entity\User $user) { $this->user = $user; $this->entries = new ArrayCollection(); diff --git a/src/Wallabag/CoreBundle/Tests/EventListener/RegistrationConfirmedListenerTest.php b/src/Wallabag/CoreBundle/Tests/EventListener/RegistrationConfirmedListenerTest.php index 137c097c..df94fad2 100644 --- a/src/Wallabag/CoreBundle/Tests/EventListener/RegistrationConfirmedListenerTest.php +++ b/src/Wallabag/CoreBundle/Tests/EventListener/RegistrationConfirmedListenerTest.php @@ -9,8 +9,8 @@ use Symfony\Component\HttpFoundation\Response; use FOS\UserBundle\FOSUserEvents; use FOS\UserBundle\Event\FilterUserResponseEvent; use Wallabag\CoreBundle\EventListener\RegistrationConfirmedListener; -use Wallabag\CoreBundle\Entity\User; use Wallabag\CoreBundle\Entity\Config; +use Wallabag\UserBundle\Entity\User; class RegistrationConfirmedListenerTest extends KernelTestCase { diff --git a/src/Wallabag/CoreBundle/Tests/WallabagCoreTestCase.php b/src/Wallabag/CoreBundle/Tests/WallabagCoreTestCase.php index 756525a9..e5096528 100644 --- a/src/Wallabag/CoreBundle/Tests/WallabagCoreTestCase.php +++ b/src/Wallabag/CoreBundle/Tests/WallabagCoreTestCase.php @@ -21,7 +21,7 @@ abstract class WallabagCoreTestCase extends WebTestCase public function logInAs($username) { $crawler = $this->client->request('GET', '/login'); - $form = $crawler->filter('input[type=submit]')->form(); + $form = $crawler->filter('button[type=submit]')->form(); $data = array( '_username' => $username, '_password' => 'mypassword', diff --git a/src/Wallabag/UserBundle/DataFixtures/ORM/LoadUserData.php b/src/Wallabag/UserBundle/DataFixtures/ORM/LoadUserData.php new file mode 100644 index 00000000..d48855da --- /dev/null +++ b/src/Wallabag/UserBundle/DataFixtures/ORM/LoadUserData.php @@ -0,0 +1,50 @@ +setName('Big boss'); + $userAdmin->setEmail('bigboss@wallabag.org'); + $userAdmin->setUsername('admin'); + $userAdmin->setPlainPassword('mypassword'); + $userAdmin->setEnabled(true); + $userAdmin->addRole('ROLE_SUPER_ADMIN'); + + $manager->persist($userAdmin); + + $this->addReference('admin-user', $userAdmin); + + $bobUser = new User(); + $bobUser->setName('Bobby'); + $bobUser->setEmail('bobby@wallabag.org'); + $bobUser->setUsername('bob'); + $bobUser->setPlainPassword('mypassword'); + $bobUser->setEnabled(true); + + $manager->persist($bobUser); + + $this->addReference('bob-user', $bobUser); + + $manager->flush(); + } + + /** + * {@inheritdoc} + */ + public function getOrder() + { + return 10; + } +} diff --git a/src/Wallabag/UserBundle/Resources/views/Default/index.html.twig b/src/Wallabag/UserBundle/Resources/views/Default/index.html.twig deleted file mode 100644 index 4ce626e9..00000000 --- a/src/Wallabag/UserBundle/Resources/views/Default/index.html.twig +++ /dev/null @@ -1 +0,0 @@ -Hello {{ name }}! diff --git a/src/Wallabag/UserBundle/Resources/views/themes/material/Registration/register.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/material/Registration/register.html.twig new file mode 100644 index 00000000..d765c851 --- /dev/null +++ b/src/Wallabag/UserBundle/Resources/views/themes/material/Registration/register.html.twig @@ -0,0 +1,32 @@ +{% extends "WallabagCoreBundle::layout.html.twig" %} + +{% block title %}{% trans %}create an account{% endtrans %}{% endblock %} + +{% block body_class %}register{% endblock %} + +{% block menu %}{% endblock %} +{% block messages %}{% endblock %} + +{% block content %} +
+
+
+
wallabag logo
+ + {% include "FOSUserBundle:Registration:register_content.html.twig" %} + +
+ +
+
+ +{% endblock %} + +{% block footer %} +{% endblock %} diff --git a/src/Wallabag/UserBundle/Resources/views/themes/material/Registration/register_content.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/material/Registration/register_content.html.twig new file mode 100644 index 00000000..26a91433 --- /dev/null +++ b/src/Wallabag/UserBundle/Resources/views/themes/material/Registration/register_content.html.twig @@ -0,0 +1,14 @@ +{% trans_default_domain 'FOSUserBundle' %} + +
+
+ {{ form_widget(form) }} + +
+
+ +
+
diff --git a/src/Wallabag/UserBundle/Resources/views/themes/material/Security/checkEmail.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/material/Security/checkEmail.html.twig new file mode 100644 index 00000000..8f698e17 --- /dev/null +++ b/src/Wallabag/UserBundle/Resources/views/themes/material/Security/checkEmail.html.twig @@ -0,0 +1,27 @@ +{% extends "WallabagCoreBundle::layout.html.twig" %} + +{% block title %}{% trans %}Forgot password{% endtrans %}{% endblock %} + +{% block body_class %}login{% endblock %} + +{% block menu %}{% endblock %} + +{% block content %} +
+
+

{% trans %}Forgot password{% endtrans %}

+
+
+ +

{{ 'An email has been sent to %email%. It contains a link you must click to reset your password.'|trans({'%email%': email}) }}

+
+
+
+
+
+ +{% endblock %} diff --git a/src/Wallabag/UserBundle/Resources/views/themes/material/Security/forgotPassword.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/material/Security/forgotPassword.html.twig new file mode 100644 index 00000000..9750f8ba --- /dev/null +++ b/src/Wallabag/UserBundle/Resources/views/themes/material/Security/forgotPassword.html.twig @@ -0,0 +1,59 @@ +{% extends "WallabagCoreBundle::layout.html.twig" %} + +{% block title %}{% trans %}Forgot password{% endtrans %}{% endblock %} + +{% block body_class %}login{% endblock %} + +{% block menu %}{% endblock %} + +{% block content %} +
+
+

{% trans %}Forgot password{% endtrans %}

+
+
+
+ +

{% trans %}Enter your email address below and we'll send you password reset instructions.{% endtrans %}

+ + {% if form_errors(form) %} + {{ form_errors(form) }} + {% endif %} + + {% for flashMessage in app.session.flashbag.get('notice') %} +

{{ flashMessage }}

+ {% endfor %} + + {% if form_errors(form.email) %} + {{ form_errors(form.email) }} + {% endif %} + +
+ {{ form_label(form.email) }} + {{ form_widget(form.email) }} +
+ +
+
+ +
+ {{ form_rest(form) }} +
+
+ +
+
+ +{% endblock %} + +{% block footer %} +{% endblock %} diff --git a/src/Wallabag/UserBundle/Resources/views/themes/material/Security/login.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/material/Security/login.html.twig new file mode 100644 index 00000000..e9532037 --- /dev/null +++ b/src/Wallabag/UserBundle/Resources/views/themes/material/Security/login.html.twig @@ -0,0 +1,69 @@ +{% extends "WallabagCoreBundle::layout.html.twig" %} + +{% block title %}{% trans %}login to your wallabag{% endtrans %}{% endblock %} + +{% block body_class %}login{% endblock %} + +{% block menu %}{% endblock %} +{% block messages %}{% endblock %} + +{% block content %} +
+
+
+
wallabag logo
+
+
+ + {% if error %} + {{ error.message }} + {% endif %} + + {% for flashMessage in app.session.flashbag.get('notice') %} +

{{ flashMessage }}

+ {% endfor %} + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ +
+
+ + + {% trans %}Register{% endtrans %} +
+
+
+ +
+
+ +{% endblock %} + +{% block footer %} +{% endblock %} diff --git a/src/Wallabag/UserBundle/Resources/views/themes/material/Security/reset.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/material/Security/reset.html.twig new file mode 100644 index 00000000..09d0b634 --- /dev/null +++ b/src/Wallabag/UserBundle/Resources/views/themes/material/Security/reset.html.twig @@ -0,0 +1,57 @@ +{% extends "WallabagCoreBundle::layout.html.twig" %} + +{% block title %}{% trans %}Change password{% endtrans %}{% endblock %} + +{% block body_class %}login{% endblock %} + +{% block menu %}{% endblock %} + +{% block content %} +
+
+
+
+
+ +

{% trans %}Change password{% endtrans %}

+ + {% if form_errors(form) %} + {{ form_errors(form) }} + {% endif %} + + {% if form_errors(form.new_password.first) %} + {{ form_errors(form.new_password.first) }} + {% endif %} + + {% if form_errors(form.new_password.second) %} + {{ form_errors(form.new_password.second) }} + {% endif %} + +
+ {{ form_label(form.new_password.first) }} + {{ form_widget(form.new_password.first) }} +
+ +
+ {{ form_label(form.new_password.second) }} + {{ form_widget(form.new_password.second) }} +
+ +
+
+ +
+ {{ form_rest(form) }} +
+
+
+
+ +{% endblock %} diff --git a/src/Wallabag/UserBundle/WallabagUserBundle.php b/src/Wallabag/UserBundle/WallabagUserBundle.php index e6e65042..d9180b3b 100644 --- a/src/Wallabag/UserBundle/WallabagUserBundle.php +++ b/src/Wallabag/UserBundle/WallabagUserBundle.php @@ -6,4 +6,8 @@ use Symfony\Component\HttpKernel\Bundle\Bundle; class WallabagUserBundle extends Bundle { + public function getParent() + { + return 'FOSUserBundle'; + } } -- cgit v1.2.3