From ec3ce598f6423fcccd88a4fdd77f817c50bc5ab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Mon, 5 Oct 2015 22:16:18 +0200 Subject: material design for register/login/recover pages --- .../UserBundle/Controller/ResettingController.php | 75 +++++++++++++++++ .../themes/baggy/Registration/register.html.twig | 20 +++++ .../baggy/Registration/register_content.html.twig | 38 +++++++++ .../themes/baggy/Resetting/checkEmail.html.twig | 17 ++++ .../views/themes/baggy/Resetting/request.html.twig | 20 +++++ .../baggy/Resetting/request_content.html.twig | 17 ++++ .../views/themes/baggy/Security/login.html.twig | 40 +++++++++ .../changePassword_content.html.twig | 12 +++ .../material/Registration/checkEmail.html.twig | 11 +++ .../material/Registration/confirmed.html.twig | 17 ++++ .../material/Registration/register.html.twig | 32 ------- .../Registration/register_content.html.twig | 40 ++++++++- .../themes/material/Resetting/checkEmail.html.twig | 11 +++ .../Resetting/passwordAlreadyRequested.html.twig | 11 +++ .../material/Resetting/request_content.html.twig | 26 ++++++ .../material/Resetting/reset_content.html.twig | 15 ++++ .../themes/material/Security/checkEmail.html.twig | 27 ------ .../material/Security/forgotPassword.html.twig | 59 ------------- .../views/themes/material/Security/login.html.twig | 97 +++++++++------------- .../views/themes/material/Security/reset.html.twig | 57 ------------- .../views/themes/material/layout.html.twig | 26 ++++++ 21 files changed, 429 insertions(+), 239 deletions(-) create mode 100644 src/Wallabag/UserBundle/Controller/ResettingController.php create mode 100644 src/Wallabag/UserBundle/Resources/views/themes/baggy/Registration/register.html.twig create mode 100644 src/Wallabag/UserBundle/Resources/views/themes/baggy/Registration/register_content.html.twig create mode 100644 src/Wallabag/UserBundle/Resources/views/themes/baggy/Resetting/checkEmail.html.twig create mode 100644 src/Wallabag/UserBundle/Resources/views/themes/baggy/Resetting/request.html.twig create mode 100644 src/Wallabag/UserBundle/Resources/views/themes/baggy/Resetting/request_content.html.twig create mode 100644 src/Wallabag/UserBundle/Resources/views/themes/baggy/Security/login.html.twig create mode 100644 src/Wallabag/UserBundle/Resources/views/themes/material/ChangePassword/changePassword_content.html.twig create mode 100644 src/Wallabag/UserBundle/Resources/views/themes/material/Registration/checkEmail.html.twig create mode 100644 src/Wallabag/UserBundle/Resources/views/themes/material/Registration/confirmed.html.twig delete mode 100644 src/Wallabag/UserBundle/Resources/views/themes/material/Registration/register.html.twig create mode 100644 src/Wallabag/UserBundle/Resources/views/themes/material/Resetting/checkEmail.html.twig create mode 100644 src/Wallabag/UserBundle/Resources/views/themes/material/Resetting/passwordAlreadyRequested.html.twig create mode 100644 src/Wallabag/UserBundle/Resources/views/themes/material/Resetting/request_content.html.twig create mode 100644 src/Wallabag/UserBundle/Resources/views/themes/material/Resetting/reset_content.html.twig delete mode 100644 src/Wallabag/UserBundle/Resources/views/themes/material/Security/checkEmail.html.twig delete mode 100644 src/Wallabag/UserBundle/Resources/views/themes/material/Security/forgotPassword.html.twig delete mode 100644 src/Wallabag/UserBundle/Resources/views/themes/material/Security/reset.html.twig create mode 100644 src/Wallabag/UserBundle/Resources/views/themes/material/layout.html.twig (limited to 'src/Wallabag/UserBundle') diff --git a/src/Wallabag/UserBundle/Controller/ResettingController.php b/src/Wallabag/UserBundle/Controller/ResettingController.php new file mode 100644 index 00000000..8aa1e230 --- /dev/null +++ b/src/Wallabag/UserBundle/Controller/ResettingController.php @@ -0,0 +1,75 @@ +get('fos_user.resetting.form.factory'); + /** @var $userManager \FOS\UserBundle\Model\UserManagerInterface */ + $userManager = $this->get('fos_user.user_manager'); + /** @var $dispatcher \Symfony\Component\EventDispatcher\EventDispatcherInterface */ + $dispatcher = $this->get('event_dispatcher'); + + $user = $userManager->findUserByConfirmationToken($token); + + if (null === $user) { + throw new NotFoundHttpException(sprintf('The user with "confirmation token" does not exist for value "%s"', $token)); + } + + $event = new GetResponseUserEvent($user, $request); + $dispatcher->dispatch(FOSUserEvents::RESETTING_RESET_INITIALIZE, $event); + + if (null !== $event->getResponse()) { + return $event->getResponse(); + } + + $form = $formFactory->createForm(); + $form->setData($user); + + $form->handleRequest($request); + + if ($form->isValid()) { + $event = new FormEvent($form, $request); + $dispatcher->dispatch(FOSUserEvents::RESETTING_RESET_SUCCESS, $event); + + $userManager->updateUser($user); + + if (null === $response = $event->getResponse()) { + $this->get('session')->getFlashBag()->add( + 'notice', + 'Password updated' + ); + $url = $this->generateUrl('homepage'); + $response = new RedirectResponse($url); + } + + $dispatcher->dispatch(FOSUserEvents::RESETTING_RESET_COMPLETED, new FilterUserResponseEvent($user, $request, $response)); + + return $response; + } + + return $this->render('FOSUserBundle:Resetting:reset.html.twig', array( + 'token' => $token, + 'form' => $form->createView(), + )); + } +} diff --git a/src/Wallabag/UserBundle/Resources/views/themes/baggy/Registration/register.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/baggy/Registration/register.html.twig new file mode 100644 index 00000000..e5c1876b --- /dev/null +++ b/src/Wallabag/UserBundle/Resources/views/themes/baggy/Registration/register.html.twig @@ -0,0 +1,20 @@ +{% extends "WallabagCoreBundle::layout.html.twig" %} + +{% block title %}{% trans %}create an account{% endtrans %}{% endblock %} + +{% block body_class %}login{% endblock %} + +{% block menu %}{% endblock %} +{% block messages %}{% endblock %} + +{% block content %} +
+
+

{% trans %}create an account{% endtrans %}

+ {% include "FOSUserBundle:Registration:register_content.html.twig" %} +
+
+{% endblock %} + +{% block footer %} +{% endblock %} diff --git a/src/Wallabag/UserBundle/Resources/views/themes/baggy/Registration/register_content.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/baggy/Registration/register_content.html.twig new file mode 100644 index 00000000..f1f899d2 --- /dev/null +++ b/src/Wallabag/UserBundle/Resources/views/themes/baggy/Registration/register_content.html.twig @@ -0,0 +1,38 @@ +{% trans_default_domain 'FOSUserBundle' %} + +{{ form_errors(form) }} +{{ form_widget(form._token) }} + +{% for flashMessage in app.session.flashbag.get('notice') %} +

{{ flashMessage }}

+{% endfor %} + +
+ {{ form_errors(form.email) }} + + +
+ +
+ {{ form_errors(form.username) }} + + +
+ +
+ {{ form_errors(form.plainPassword.first) }} + + +
+ +
+ {{ form_errors(form.plainPassword.second) }} + + +
+ + +
+ + {% trans %}Login{% endtrans %} +
diff --git a/src/Wallabag/UserBundle/Resources/views/themes/baggy/Resetting/checkEmail.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/baggy/Resetting/checkEmail.html.twig new file mode 100644 index 00000000..056d65b5 --- /dev/null +++ b/src/Wallabag/UserBundle/Resources/views/themes/baggy/Resetting/checkEmail.html.twig @@ -0,0 +1,17 @@ +{% 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/baggy/Resetting/request.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/baggy/Resetting/request.html.twig new file mode 100644 index 00000000..10094e83 --- /dev/null +++ b/src/Wallabag/UserBundle/Resources/views/themes/baggy/Resetting/request.html.twig @@ -0,0 +1,20 @@ +{% extends "WallabagCoreBundle::layout.html.twig" %} + +{% block title %}{% trans %}Forgot password{% endtrans %}{% endblock %} + +{% block body_class %}login{% endblock %} + +{% block menu %}{% endblock %} +{% block messages %}{% endblock %} + +{% block content %} +
+
+

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

+ {% include "FOSUserBundle:Resetting:request_content.html.twig" %} +
+
+{% endblock %} + +{% block footer %} +{% endblock %} diff --git a/src/Wallabag/UserBundle/Resources/views/themes/baggy/Resetting/request_content.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/baggy/Resetting/request_content.html.twig new file mode 100644 index 00000000..1f8da8d7 --- /dev/null +++ b/src/Wallabag/UserBundle/Resources/views/themes/baggy/Resetting/request_content.html.twig @@ -0,0 +1,17 @@ +{% trans_default_domain 'FOSUserBundle' %} + +{% trans %}Enter your email address below and we'll send you password reset instructions.{% endtrans %} + +{% if invalid_username is defined %} +

{{ 'resetting.request.invalid_username'|trans({'%username%': invalid_username}) }}

+{% endif %} + +
+ + +
+ +
+ + {% trans %}Login{% endtrans %} +
diff --git a/src/Wallabag/UserBundle/Resources/views/themes/baggy/Security/login.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/baggy/Security/login.html.twig new file mode 100644 index 00000000..0e7bba0f --- /dev/null +++ b/src/Wallabag/UserBundle/Resources/views/themes/baggy/Security/login.html.twig @@ -0,0 +1,40 @@ +{% 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 %} +
+
+

{% trans %}Login to wallabag{% endtrans %}

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

{{ flashMessage }}

+ {% endfor %} + +
+ + +
+ +
+ + +
+ + +
+
+{% endblock %} diff --git a/src/Wallabag/UserBundle/Resources/views/themes/material/ChangePassword/changePassword_content.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/material/ChangePassword/changePassword_content.html.twig new file mode 100644 index 00000000..e7b7318b --- /dev/null +++ b/src/Wallabag/UserBundle/Resources/views/themes/material/ChangePassword/changePassword_content.html.twig @@ -0,0 +1,12 @@ +{% trans_default_domain 'FOSUserBundle' %} + +
+
+
+ {{ form_widget(form) }} +
+ +
+
+
+
diff --git a/src/Wallabag/UserBundle/Resources/views/themes/material/Registration/checkEmail.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/material/Registration/checkEmail.html.twig new file mode 100644 index 00000000..50937276 --- /dev/null +++ b/src/Wallabag/UserBundle/Resources/views/themes/material/Registration/checkEmail.html.twig @@ -0,0 +1,11 @@ +{% extends "FOSUserBundle::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/src/Wallabag/UserBundle/Resources/views/themes/material/Registration/confirmed.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/material/Registration/confirmed.html.twig new file mode 100644 index 00000000..c6d4d3d2 --- /dev/null +++ b/src/Wallabag/UserBundle/Resources/views/themes/material/Registration/confirmed.html.twig @@ -0,0 +1,17 @@ +{% extends "FOSUserBundle::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/src/Wallabag/UserBundle/Resources/views/themes/material/Registration/register.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/material/Registration/register.html.twig deleted file mode 100644 index d765c851..00000000 --- a/src/Wallabag/UserBundle/Resources/views/themes/material/Registration/register.html.twig +++ /dev/null @@ -1,32 +0,0 @@ -{% 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 index 26a91433..b356f58c 100644 --- 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 @@ -2,12 +2,44 @@
- {{ form_widget(form) }} - +
+ + {{ form_errors(form) }} + {{ form_widget(form._token) }} + + {% for flashMessage in app.session.flashbag.get('notice') %} +

{{ flashMessage }}

+ {% endfor %} + +
+ {{ form_errors(form.email) }} + + +
+ +
+ {{ form_errors(form.username) }} + + +
+ +
+ {{ form_errors(form.plainPassword.first) }} + + +
+ +
+ {{ form_errors(form.plainPassword.second) }} + + +
+
-
+
+ {% trans %}Login{% endtrans %}
diff --git a/src/Wallabag/UserBundle/Resources/views/themes/material/Resetting/checkEmail.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/material/Resetting/checkEmail.html.twig new file mode 100644 index 00000000..66cbdc28 --- /dev/null +++ b/src/Wallabag/UserBundle/Resources/views/themes/material/Resetting/checkEmail.html.twig @@ -0,0 +1,11 @@ +{% extends "FOSUserBundle::layout.html.twig" %} + +{% trans_default_domain 'FOSUserBundle' %} + +{% block fos_user_content %} +
+
+ {{ 'resetting.check_email'|trans({'%email%': email}) }} +
+
+{% endblock fos_user_content %} diff --git a/src/Wallabag/UserBundle/Resources/views/themes/material/Resetting/passwordAlreadyRequested.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/material/Resetting/passwordAlreadyRequested.html.twig new file mode 100644 index 00000000..0eec4301 --- /dev/null +++ b/src/Wallabag/UserBundle/Resources/views/themes/material/Resetting/passwordAlreadyRequested.html.twig @@ -0,0 +1,11 @@ +{% extends "FOSUserBundle::layout.html.twig" %} + +{% trans_default_domain 'FOSUserBundle' %} + +{% block fos_user_content %} +
+
+ {{ 'resetting.password_already_requested'|trans }} +
+
+{% endblock fos_user_content %} diff --git a/src/Wallabag/UserBundle/Resources/views/themes/material/Resetting/request_content.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/material/Resetting/request_content.html.twig new file mode 100644 index 00000000..e871d7be --- /dev/null +++ b/src/Wallabag/UserBundle/Resources/views/themes/material/Resetting/request_content.html.twig @@ -0,0 +1,26 @@ +{% trans_default_domain 'FOSUserBundle' %} + +
+
+

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

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

{{ flashMessage }}

+ {% endfor %} + + {% if invalid_username is defined %} +

{{ 'resetting.request.invalid_username'|trans({'%username%': invalid_username}) }}

+ {% endif %} + +
+ + +
+
+
+
+ {% trans %}Login{% endtrans %} + +
+ diff --git a/src/Wallabag/UserBundle/Resources/views/themes/material/Resetting/reset_content.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/material/Resetting/reset_content.html.twig new file mode 100644 index 00000000..f7e061dd --- /dev/null +++ b/src/Wallabag/UserBundle/Resources/views/themes/material/Resetting/reset_content.html.twig @@ -0,0 +1,15 @@ +{% 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 deleted file mode 100644 index 8f698e17..00000000 --- a/src/Wallabag/UserBundle/Resources/views/themes/material/Security/checkEmail.html.twig +++ /dev/null @@ -1,27 +0,0 @@ -{% 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 deleted file mode 100644 index 9750f8ba..00000000 --- a/src/Wallabag/UserBundle/Resources/views/themes/material/Security/forgotPassword.html.twig +++ /dev/null @@ -1,59 +0,0 @@ -{% 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 index e9532037..6bf99bf8 100644 --- a/src/Wallabag/UserBundle/Resources/views/themes/material/Security/login.html.twig +++ b/src/Wallabag/UserBundle/Resources/views/themes/material/Security/login.html.twig @@ -1,69 +1,46 @@ -{% extends "WallabagCoreBundle::layout.html.twig" %} +{% extends "FOSUserBundle::layout.html.twig" %} -{% block title %}{% trans %}login to your wallabag{% endtrans %}{% endblock %} +{% block fos_user_content %} +
+
-{% block body_class %}login{% endblock %} + {% if error %} + {{ error.message }} + {% endif %} -{% block menu %}{% endblock %} -{% block messages %}{% endblock %} + {% for flashMessage in app.session.flashbag.get('notice') %} +

{{ flashMessage }}

+ {% endfor %} -{% block content %} -
-
-
-
wallabag logo
- -
+
- {% if error %} - {{ error.message }} - {% endif %} - - {% for flashMessage in app.session.flashbag.get('notice') %} -

{{ flashMessage }}

- {% endfor %} - -
- -
- - -
- -
- - -
- -
- - -
- -
+
+ + +
-
-
- - - {% trans %}Register{% endtrans %} -
- +
+ +
-
- {% trans %}Forgot your password?{% endtrans %} + +
+ +
-
-
- -{% endblock %} -{% block footer %} -{% endblock %} +
+
+
+ + {% trans %}Register{% endtrans %} + +
+
+ {% trans %}Forgot your password?{% endtrans %} +
+ +{% endblock fos_user_content %} 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 deleted file mode 100644 index 09d0b634..00000000 --- a/src/Wallabag/UserBundle/Resources/views/themes/material/Security/reset.html.twig +++ /dev/null @@ -1,57 +0,0 @@ -{% 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/Resources/views/themes/material/layout.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/material/layout.html.twig new file mode 100644 index 00000000..0305ea45 --- /dev/null +++ b/src/Wallabag/UserBundle/Resources/views/themes/material/layout.html.twig @@ -0,0 +1,26 @@ +{% extends "WallabagCoreBundle::layout.html.twig" %} + +{% block title %}Welcome on wallabag!{% endblock %} + +{% block menu %}{% endblock %} +{% block messages %}{% endblock %} + +{% block content %} +
+
+
+
wallabag logo
+ {% block fos_user_content %} + {% endblock fos_user_content %} +
+
+
+ +{% endblock %} + +{% block footer %} +{% endblock %} -- cgit v1.2.3