Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add symfonycasts/reset-password-bundle@1.11 template #53

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
abbfa4a
Add `symfonycasts/reset-password-bundle@1.11` template
Jan 10, 2022
eb0c257
Update templates/security.html.twig
cavasinf Jan 11, 2022
b4eee0e
Re-use existing translations
Jan 11, 2022
76b2781
Update link to redo password reset
Jan 11, 2022
4843248
Add default titles
Jan 11, 2022
5c14296
Add block help request
Jan 11, 2022
0807bdb
Fix indents
Jan 11, 2022
c3f016e
Add base template for `reset_password` templates
Jan 11, 2022
fb0834e
Update DOC
Jan 11, 2022
328c8d1
Add french translations
Jan 31, 2022
2b61fac
BugFix translation FR
Feb 1, 2022
b31899f
Merge branch 'main' into feature/reset-password
Feb 18, 2022
106bcc0
Merge branch 'main' into feature/reset-password
Apr 13, 2022
0148977
Add more detailed french translations
cavasinf May 17, 2022
ff46569
Merge branch 'main' into feature/reset-password
cavasinf Dec 19, 2022
d72b422
Ranme `base` into `_layout` + use submit button macro
cavasinf Dec 19, 2022
bf1f236
Remove unused password-reset html
cavasinf Dec 23, 2022
9b34bae
Rervert BC break from login logo
cavasinf Dec 23, 2022
4f4dfca
Add default english translation
cavasinf Dec 23, 2022
cf49f78
Revert "Remove unused password-reset html"
cavasinf Dec 23, 2022
37539d7
Deprecate the `password-reset` template
cavasinf Dec 23, 2022
78d7a9d
Revert delete config option
cavasinf Jan 5, 2023
33a95c6
Revert delete config option
cavasinf Jan 5, 2023
f85204b
Add link to doc
cavasinf Jan 6, 2023
aafd6fd
Suggest reset-password-bundle
cavasinf Jan 6, 2023
703d23d
Add german translations
cavasinf Jan 6, 2023
2ae492a
`check_email.html.twig` should be `check-email.html.twig`
cavasinf Jan 6, 2023
5681f15
Update DOC
cavasinf Jan 6, 2023
75f60be
Merge branch 'main' into feature/reset-password
cavasinf Jan 6, 2023
fbacc9f
Change translation template EN
cavasinf Jan 6, 2023
950b9de
use alert component
cavasinf Jan 6, 2023
4db12a8
Rename `token` to `expirationMessage`
cavasinf Jan 16, 2023
322aa0c
Merge branch 'kevinpapst:main' into feature/reset-password
cavasinf Dec 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion config/packages/tabler.yaml
Expand Up @@ -32,7 +32,6 @@ tabler:
tabler_registration: registration
tabler_registration_register: registration_register
tabler_password_reset: resetting_request
tabler_password_reset_sent: resetting_send_email
cavasinf marked this conversation as resolved.
Show resolved Hide resolved

icons:
# used for the action_collapsebutton components
Expand Down
43 changes: 43 additions & 0 deletions 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 %}
<a href="." class="navbar-brand navbar-brand-autodark">
<img src="{{ asset('images/logo.svg') }}" height="36">
</a>
{% endblock %}
```

### Extra

You shouldn't directly extend `@Tabler\security\reset_password\base.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.
4 changes: 0 additions & 4 deletions src/DependencyInjection/Configuration.php
Expand Up @@ -79,10 +79,6 @@ private function getRouteAliasesConfig(): NodeDefinition
->defaultNull()
->info('name of the forgot-password form route')
->end()
->scalarNode('tabler_password_reset_sent')
->defaultNull()
->info('name of the sent forgot-password email form route')
->end()
->end()
->end();

Expand Down
2 changes: 1 addition & 1 deletion templates/security.html.twig
Expand Up @@ -16,7 +16,7 @@
<div class="page page-center">
<div class="container-tight py-4">
<div class="text-center mb-4">
<h1>{% block logo_login %}Tabler{% endblock %}</h1>
{% block logo_login %}<h1>{% block title_login %}Tabler{% endblock %}</h1>{% endblock %}
cavasinf marked this conversation as resolved.
Show resolved Hide resolved
</div>

<div class="card card-md">
Expand Down
30 changes: 0 additions & 30 deletions templates/security/password-reset.html.twig

This file was deleted.

9 changes: 9 additions & 0 deletions templates/security/reset_password/base.html.twig
@@ -0,0 +1,9 @@
{% extends '@Tabler/security.html.twig' %}

{% block login_social_auth %}{% endblock %}

{% block login_box_error %}
{% for flashError in app.flashes('reset_password_error') %}
<div class="alert alert-important alert-danger">{{ flashError }}</div>
{% endfor %}
{% endblock %}
17 changes: 17 additions & 0 deletions templates/security/reset_password/check_email.html.twig
@@ -0,0 +1,17 @@
{% extends '@Tabler/security/reset_password/base.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 token = resetToken.expirationMessageKey|trans(resetToken.expirationMessageData, 'ResetPasswordBundle') %}
<p>
{{ '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 %token%.' | trans({'%token%' : token}, 'TablerBundle') }}
</p>
<p>{{ "If you don't receive an email please check your spam folder or"|trans({}, 'TablerBundle') }} <a href="{{ path('tabler_password_reset'|tabler_route) }}">{{ 'Try again'|trans({}, 'TablerBundle') }}</a>.</p>
{% endblock %}
36 changes: 36 additions & 0 deletions templates/security/reset_password/request.html.twig
@@ -0,0 +1,36 @@
{% extends '@Tabler/security/reset_password/base.html.twig' %}

{% 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 %}
<p class="text-muted mb-4">{{ 'Enter your email address and your password will be reset and emailed to you'|trans({}, 'TablerBundle') }}</p>
{% endblock %}

{{ form_start(requestForm) }}

{{ form_row(requestForm.email) }}

<div class="form-footer">
<button type="submit" class="btn btn-primary w-100">
{{ tabler_icon('mail') }}
{{ 'Reset your password'|trans({}, 'TablerBundle') }}
</button>
</div>

{{ form_end(requestForm) }}
{% endblock %}

{% block login_actions %}
<div class="text-center text-muted mt-3">
<a href="{{ path('tabler_login'|tabler_route) }}">
{{ 'Back to login'|trans({}, 'TablerBundle') }}
</a>
</div>
{% endblock %}
22 changes: 22 additions & 0 deletions templates/security/reset_password/reset.html.twig
@@ -0,0 +1,22 @@
{% extends '@Tabler/security/reset_password/base.html.twig' %}

{% 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) }}

<div class="form-footer">
<button type="submit" class="btn btn-primary w-100">
{{ 'Reset your password'|trans({}, 'TablerBundle') }}
</button>
</div>

{{ form_end(resetForm) }}
{% endblock %}
1 change: 0 additions & 1 deletion tests/DependencyInjection/ConfigurationTest.php
Expand Up @@ -69,7 +69,6 @@ protected function getDefaultConfig()
'tabler_registration' => null,
'tabler_registration_register' => null,
'tabler_password_reset' => null,
'tabler_password_reset_sent' => null,
cavasinf marked this conversation as resolved.
Show resolved Hide resolved
],
'icons' => [],
]
Expand Down
20 changes: 20 additions & 0 deletions translations/TablerBundle.fr.xliff
Expand Up @@ -106,6 +106,26 @@
<source>Take me home</source>
<target>Retourner au début</target>
</trans-unit>
<trans-unit id="Password Reset Email Sent">
<source>Password Reset Email Sent</source>
<target>Email réinitialisation de mot de passe envoyé</target>
cavasinf marked this conversation as resolved.
Show resolved Hide resolved
</trans-unit>
<trans-unit id="Enter your email address and your password will be reset and emailed to you">
<source>Enter your email address and your password will be reset and emailed to you</source>
cavasinf marked this conversation as resolved.
Show resolved Hide resolved
<target>Saisissez votre adresse email et votre mot de passe sera réinitialisé par mail</target>
</trans-unit>
<trans-unit id="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 %token%.">
<source>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 %token%.</source>
<target>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 %token%.</target>
</trans-unit>
<trans-unit id="If you don't receive an email please check your spam folder or">
<source>If you don't receive an email please check your spam folder or</source>
cavasinf marked this conversation as resolved.
Show resolved Hide resolved
<target>Si vous n'avez pas reçu d'email, merci de vérifier vos spams ou</target>
</trans-unit>
<trans-unit id="Try again">
<source>Try again</source>
<target>Essayer à nouveau</target>
</trans-unit>
</body>
</file>
</xliff>