TablerBundle
TablerBundle copied to clipboard
Add `symfonycasts/[email protected]` template
Description
From https://github.com/kevinpapst/TablerBundle/issues/10
More here: https://github.com/SymfonyCasts/reset-password-bundle
Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist
- [x] I updated the documentation (see here)
- [x] I agree that this code will be published under the MIT license
@kevinpapst How do you generate your trads file in the Bundle ?
php bin/console translation:extract --force fr ?
@kevinpapst How do you generate your trads file in the Bundle ?
php bin/console translation:extract --force fr?
@kevinpapst Any answer of that?
Never used that command I guess. I always create translation files while developing views.
Missing translations !
@kevinpapst Any feedback on that ?
Honestly: I can't remember where I stopped. I have no use-case right now. Can we add it to the demo app?
Can we add it to the demo app?
Yes we can.
The problem was the english wording that looks like google translation 101. See review comments
@kevinpapst I'll be again a pain in the ***, but I also need that PR 😄
Translations was not good enough for you.
They were auto-generated by make:reset-password.
If this works in Demo would you merge it ? Then, can you create a branch in TablerBundle Demo with that PR please ?
I've no idea where the code comes from (Git repo ?), so I'll paste here what files this command generate (with the 101 translation).
check_email.html.twig
{% extends 'base.html.twig' %}
{% block title %}Password Reset Email Sent{% endblock %}
{% block body %}
<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 {{ resetToken.expirationMessageKey|trans(resetToken.expirationMessageData, 'ResetPasswordBundle') }}.
</p>
<p>If you don't receive an email please check your spam folder or <a href="{{ path('app_forgot_password_request') }}">try again</a>.</p>
{% endblock %}
email.html.twig
<h1>Hi!</h1>
<p>To reset your password, please visit the following link</p>
<a href="{{ url('app_reset_password', {token: resetToken.token}) }}">{{ url('app_reset_password', {token: resetToken.token}) }}</a>
<p>This link will expire in {{ resetToken.expirationMessageKey|trans(resetToken.expirationMessageData, 'ResetPasswordBundle') }}.</p>
<p>Cheers!</p>
request.html.twig
{% extends 'base.html.twig' %}
{% block title %}Reset your password{% endblock %}
{% block body %}
{% for flash_error in app.flashes('reset_password_error') %}
<div class="alert alert-danger" role="alert">{{ flash_error }}</div>
{% endfor %}
<h1>Reset your password</h1>
{{ form_start(requestForm) }}
{{ form_row(requestForm.email) }}
<div>
<small>
Enter your email address and we will send you a
link to reset your password.
</small>
</div>
<button class="btn btn-primary">Send password reset email</button>
{{ form_end(requestForm) }}
{% endblock %}
reset.html.twig
{% extends 'base.html.twig' %}
{% block title %}Reset your password{% endblock %}
{% block body %}
<h1>Reset your password</h1>
{{ form_start(resetForm) }}
{{ form_row(resetForm.plainPassword) }}
<button class="btn btn-primary">Reset password</button>
{{ form_end(resetForm) }}
{% endblock %}
Hey @kevinpapst, old PR but we need that in our company's projects. Since this PR is on waiting to merge, we are linked to our fork in multiple projects thus limited by the MAX amount of composer downloads on a git repo..
The last comment summarize what is the problem. Can you give it a look 👀 Thanks !
If you remove the template, apps cannot choose which logic they want. My app for example uses custom "reset password" logic and I need the template...
Wow you are active @kevinpapst 😄
If your app use that template. How do you render the 'check your email/reset confirmation' and 'insert your new password' template ? I believe that you have your own templates and own controllers to handle those cases ?
IMO, password-reset.html.twig 'template' should be defined from the app and not by the bundle because It depend on the devs logic.
THIS new template depends on the SymfonyCasts/reset-password-bundle which there is a more higher chance to fit exactly with the same dev logic (because generated automatically).
Simple spoken: I inlined the logic from FOSUserBundle to my app.
I do not trust the plugins (bad experience with fosuser bundle) and for now I want to keep the templates.
Maybe you are right and they should be moved to the app completely... but then we have to deprecate them first. I do not want to break my app with my own theme bundle with the next composer update 😁
I understand. 👍 We can apply the same though process for the 404 and 500 error page. TablerBundle provide the default error page, but not the others. It is to the devs to implement there own error pages, not TablerBundle.
Same for the reset. If I want to add the birth date in addition to the user field (OR email). I'll not ask to TableBundle dev to add that field, it's my own logic 🔢
I'll revert the delete, and mark the template as deprecated.
How do you want to handle the tabler config tabler_password_reset_sent as deprecated too ?
All set and ready to merge. ATE, only template and translations are added 👍
Can you please include these german / DE translations:
<trans-unit id="948fezF" resname="Password Reset Email Sent">
<source>Password Reset Email Sent</source>
<target>E-Mail für die Zurücksetzung des Passwort wurde gesendet</target>
</trans-unit>
<trans-unit id="5FE896d" resname="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>
<target>Geben Sie Ihre E-Mail Adresse an und Sie bekommen eine Nachricht um Ihr Passwort zurückzusetzen</target>
</trans-unit>
<trans-unit id="RG984sg" resname="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>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 %token%.</target>
</trans-unit>
<trans-unit id="498fEsz" resname="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>
<target>Wenn Sie keine E-Mail erhalten, überprüfen Sie bitte Ihren Spam Ordner oder/target>
</trans-unit>
<trans-unit id="EF54d5d" resname="Try again">
<source>Try again</source>
<target>Versuchen Sie es erneut</target>
</trans-unit>
- [x] 1. Can you link the docs page from the docs index
- [ ] 2.
_layout.html.twigdoes not match any filename convention? - [x] 3.
check_email.html.twigshould becheck-email.html.twigbecuase all files included directly by the controller should be x-y.html.twig - correct? - [x] 4. Add a composer suggest for the package
- [x] 5. Add german translations
- I see
_layout.html.twigas a "private" tamplate, others template extends from that becausesecurity.html.twigdoes not implementapp.flashesbuterror(which is not an array). AND removeslogin_social_authblocks (SeeExtrapart in DOC) Devs should not directly extends that specific file. This is why i named it outside the convention. - Ok but we need to write the bundle contribution rules somewhere 😆
Good to go 👍