diff --git a/composer.json b/composer.json index 7424b4d0..ce25dc8f 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,8 @@ "knplabs/knp-menu-bundle": "^3.0" }, "suggest" : { - "knplabs/knp-menu-bundle" : "Allows easy menu integration" + "knplabs/knp-menu-bundle" : "Allows easy menu integration", + "symfonycasts/reset-password-bundle" : "Includes all Symfony logic to reset user password" }, "autoload": { "psr-4": { diff --git a/docs/index.md b/docs/index.md index 8e0b414d..b863fe7f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -9,6 +9,7 @@ If you cannot find the needed information in this list of topics, please create * [Override theme](override_theme.md) * [Access bundle configuration](twig-context.md) * [Customizing forms](form_theme.md) +* [Reset password templates](reset_password_pages.md) Components (Twig macros): diff --git a/docs/reset_password_pages.md b/docs/reset_password_pages.md new file mode 100644 index 00000000..3405bc73 --- /dev/null +++ b/docs/reset_password_pages.md @@ -0,0 +1,43 @@ +## How it was made + +3 pre-implemented layouts are available for the `reset-password` form. + +There are inspired by `symfonycasts/reset-password-bundle@1.11`. +See here: https://github.com/SymfonyCasts/reset-password-bundle + +Filenames and variables/forms name follows what `reset-password-bundle` as generated by default. +You can of course override everything if needed. + +## Using the layout + +In order to use the layouts, +you should extend the one you want from `@Tabler/security/reset_password/`: +- check-email.html.twig +- request.html.twig +- reset.html.twig + +Here's an example for the reset request form with the email input. +```twig +{% extends '@Tabler/security/reset_password/request.html.twig' %} + +{% block logo_login %} + + + +{% endblock %} +``` + +### Extra + +You shouldn't directly extend `@Tabler\security\reset_password\_layout.html.twig`, +it's only there to emptying the `login_social_auth` block, and add the flash errors. + +If you want to make your own template with that base, you can. + +## Layout blocks + +TODO explain blocks + +## Next steps + +Please go back to the [Tabler bundle documentation](README.md) to find out more about using the theme. diff --git a/templates/security.html.twig b/templates/security.html.twig index 3741754a..789f39ed 100644 --- a/templates/security.html.twig +++ b/templates/security.html.twig @@ -20,7 +20,7 @@ {% block container_before %}{% endblock %}
-

{% block logo_login %}Tabler{% endblock %}

+ {% block logo_container %}

{% block logo_login %}Tabler{% endblock %}

{% endblock %}
diff --git a/templates/security/reset_password/_layout.html.twig b/templates/security/reset_password/_layout.html.twig new file mode 100644 index 00000000..f3064df3 --- /dev/null +++ b/templates/security/reset_password/_layout.html.twig @@ -0,0 +1,10 @@ +{% extends '@Tabler/security.html.twig' %} + +{% block login_social_auth %}{% endblock %} + +{% block login_box_error %} + {% from '@Tabler/components/alert.html.twig' import alert %} + {% for flashError in app.flashes('reset_password_error') %} + {{ alert({important: true, description : flashError}) }} + {% endfor %} +{% endblock %} diff --git a/templates/security/reset_password/check-email.html.twig b/templates/security/reset_password/check-email.html.twig new file mode 100644 index 00000000..47904a6f --- /dev/null +++ b/templates/security/reset_password/check-email.html.twig @@ -0,0 +1,17 @@ +{% extends '@Tabler/security/reset_password/_layout.html.twig' %} + +{% block title %} + {{ 'Password Reset Email Sent'|trans({}, 'TablerBundle') }} +{% endblock %} + +{% block login_box_msg %} + {{ 'Password Reset Email Sent'|trans({}, 'TablerBundle') }} +{% endblock %} + +{% block login_form %} + {% set expirationMessage = resetToken.expirationMessageKey|trans(resetToken.expirationMessageData, 'ResetPasswordBundle') %} +

+ {{ 'If an account matching your email exists, then an email was just sent that contains a link that you can use to reset your password. This link will expire in %expirationMessage%.' | trans({'%expirationMessage%' : expirationMessage}, 'TablerBundle') }} +

+

{{ "If you don't receive an email please check your spam folder or"|trans({}, 'TablerBundle') }} {{ 'Try again'|trans({}, 'TablerBundle') }}.

+{% endblock %} diff --git a/templates/security/reset_password/request.html.twig b/templates/security/reset_password/request.html.twig new file mode 100644 index 00000000..ce188d8e --- /dev/null +++ b/templates/security/reset_password/request.html.twig @@ -0,0 +1,38 @@ +{% extends '@Tabler/security/reset_password/_layout.html.twig' %} +{% from '@Tabler/components/buttons.html.twig' import submit_button %} + +{% block title %} + {{ 'I forgot my password'|trans({}, 'TablerBundle') }} +{% endblock %} + +{% block login_box_msg %} + {{ 'I forgot my password'|trans({}, 'TablerBundle') }} +{% endblock %} + +{% block login_form %} + {% block request_help %} +

{{ 'Enter your email address and you will be emailed a link that allows to reset your password'|trans({}, 'TablerBundle') }}

+ {% endblock %} + + {{ form_start(requestForm) }} + + {{ form_row(requestForm.email) }} + + + + {{ form_end(requestForm) }} +{% endblock %} + +{% block login_actions %} + +{% endblock %} diff --git a/templates/security/reset_password/reset.html.twig b/templates/security/reset_password/reset.html.twig new file mode 100644 index 00000000..5b1d4e06 --- /dev/null +++ b/templates/security/reset_password/reset.html.twig @@ -0,0 +1,26 @@ +{% extends '@Tabler/security/reset_password/_layout.html.twig' %} +{% from '@Tabler/components/buttons.html.twig' import submit_button %} + +{% block title %} + {{ 'Reset your password'|trans({}, 'TablerBundle') }} +{% endblock %} + +{% block login_box_msg %} + {{ 'Reset your password'|trans({}, 'TablerBundle') }} +{% endblock %} + +{% block login_form %} + {{ form_start(resetForm) }} + + {{ form_row(resetForm.plainPassword) }} + + + + {{ form_end(resetForm) }} +{% endblock %} diff --git a/translations/TablerBundle.de.xlf b/translations/TablerBundle.de.xlf index 6051cb9c..a968264b 100644 --- a/translations/TablerBundle.de.xlf +++ b/translations/TablerBundle.de.xlf @@ -146,6 +146,26 @@ Next Weiter + + Password Reset Email Sent + E-Mail für die Zurücksetzung des Passwort wurde gesendet + + + Enter your email address and you will be emailed a link that allows to reset your password + Geben Sie Ihre E-Mail Adresse an und Sie bekommen eine Nachricht um Ihr Passwort zurückzusetzen + + + If an account matching your email exists, then an email was just sent that contains a link that you can use to reset your password. This link will expire in %expirationMessage%. + Wenn ein Zugang mit Ihrer E-Mail existiert, wurde soeben eine E-Mail dorthin versendet, welche eine Link beinhaltet, mit dem Sie Ihr Passwort zurücksetzen können. Dieser Link wird ablaufen in %expirationMessage%. + + + If you don't receive an email please check your spam folder or + Wenn Sie keine E-Mail erhalten, überprüfen Sie bitte Ihren Spam Ordner oder/target> + + + Try again + Versuchen Sie es erneut + diff --git a/translations/TablerBundle.en.xlf b/translations/TablerBundle.en.xlf index d24da924..a85a8b1e 100644 --- a/translations/TablerBundle.en.xlf +++ b/translations/TablerBundle.en.xlf @@ -110,6 +110,26 @@ Take me home Take me home + + Password Reset Email Sent + Password Reset Email Sent + + + Enter your email address and you will be emailed a link that allows to reset your password + Enter your email address and you will be emailed a link that allows to reset your password + + + If an account matching your email exists, then an email was just sent that contains a link that you can use to reset your password. This link will expire in %expirationMessage%. + If an account matching your email exists, then an email was just sent that contains a link that you can use to reset your password. This link will expire in %expirationMessage%. + + + If you don't receive an email please check your spam folder or + If you don't receive an email please check your spam folder or + + + Try again + Try again + http_error.title Error diff --git a/translations/TablerBundle.fr.xlf b/translations/TablerBundle.fr.xlf index 1f5767ca..9f976d2e 100644 --- a/translations/TablerBundle.fr.xlf +++ b/translations/TablerBundle.fr.xlf @@ -102,6 +102,26 @@ Take me home Retourner au début + + Password Reset Email Sent + E-mail de réinitialisation du mot de passe a été envoyé + + + Enter your email address and you will be emailed a link that allows to reset your password + Saisissez votre adresse e-mail et la procédure de réinitialisation de votre mot de passe vous sera envoyée par mail + + + If an account matching your email exists, then an email was just sent that contains a link that you can use to reset your password. This link will expire in %expirationMessage%. + Si un compte correspond à l'adresse renseignée, un email vient d'être envoyé contenant un lien afin de réinitialiser votre mot de passe. Ce lien expire dans %expirationMessage%. + + + If you don't receive an email please check your spam folder or + Si vous n'avez pas reçu d'email, merci de vérifier vos spams ou + + + Try again + Essayer à nouveau + http_error.title Erreur