-
Notifications
You must be signed in to change notification settings - Fork 70
Refonte page mode de passe oublié #2367
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,36 +1,39 @@ | ||||||
| {% extends 'admin/association/membership/_base.html.twig' %} | ||||||
|
|
||||||
| {% block page_title %}{% endblock %} | ||||||
|
|
||||||
| {% block page_container_extra_classes %}remove-min-height-from-container-id{% endblock %} | ||||||
|
|
||||||
| {% block page_content %} | ||||||
|
|
||||||
| <div class="afup-form afup-form--miniform"> | ||||||
| {{ form_start(form) }} | ||||||
| <fieldset> | ||||||
| <legend>Mot de passe perdu</legend> | ||||||
| <div class="afup-form-container"> | ||||||
| <div> | ||||||
| <p> | ||||||
| Indiquez votre email ici. Si un compte correspond à cet email, vous recevrez un nouveau mot de passe. | ||||||
| </p> | ||||||
| </div> | ||||||
| <div> | ||||||
| {{ form_label(form.email) }} | ||||||
| {{ form_widget(form.email) }} | ||||||
| </div> | ||||||
| <div> | ||||||
| {{ form_widget(form.submit, {attr: {"class": "button button--call-to-action"}}) }} | ||||||
| </div> | ||||||
| <div> | ||||||
| <p> | ||||||
| <a href="{{ url('app_login') }}">Retour au formulaire de connexion</a> | ||||||
| </p> | ||||||
| </div> | ||||||
| {% extends 'layouts/site.html.twig' %} | ||||||
| {% form_theme form 'form_themes/tailwind.html.twig' %} | ||||||
|
|
||||||
| {% block title %}Mot de passe perdu - AFUP{% endblock %} | ||||||
|
|
||||||
| {% block content %} | ||||||
|
|
||||||
| <div class="container mx-auto flex flex-col items-center px-4 my-5 gap-4"> | ||||||
| <h1 class="font-titre font-normal text-5xl text-afup-800 text-center">Mot de passe perdu</h1> | ||||||
| <p class="font-sans font-normal text-base text-neutre-700 text-center max-w-2xl"> | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pareil il y a trop de classes ici.
Suggested change
|
||||||
| Indiquez votre email ici. Si un compte correspond à cet email, vous recevrez un nouveau mot de passe. | ||||||
| </p> | ||||||
|
|
||||||
| {{ form_start(form, {attr: {class: 'w-full sm:w-200'}}) }} | ||||||
|
|
||||||
| <twig:Card class="flex flex-col gap-8 px-6 py-12 sm:px-28 sm:py-12 my-5 sm:mb-10 w-full"> | ||||||
|
|
||||||
| {# Le contrôleur pose un flash 'notice' : c'est le seul retour visible de la demande, | ||||||
| et layouts/site.html.twig n'affiche pas les flashs. #} | ||||||
| {% for message in app.flashes('notice') %} | ||||||
| <twig:Alert type="success" class="w-full">{{ message }}</twig:Alert> | ||||||
| {% endfor %} | ||||||
|
|
||||||
| {{ form_errors(form) }} | ||||||
| {{ form_row(form.email, {label: 'Email', attr: {autofocus: true}}) }} | ||||||
|
|
||||||
| <div class="flex flex-col-reverse sm:flex-row items-center justify-between gap-4 border-t-2 border-neutre-300 pt-5"> | ||||||
| <p class="font-sans font-normal text-sm text-neutre-700 whitespace-nowrap"> | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| <a href="{{ path('app_login') }}" class="text-afup-500 underline hover:no-underline">Retour à la connexion</a> | ||||||
| </p> | ||||||
| {{ form_widget(form.submit) }} | ||||||
| </div> | ||||||
|
|
||||||
| </fieldset> | ||||||
| </twig:Card> | ||||||
|
|
||||||
| {{ form_end(form) }} | ||||||
| </div> | ||||||
|
|
||||||
| {% endblock %} | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Un test avec autant de mocks ne me parait pas une bonne idée. Ce serait mieux, soit d'avoir un test behat, soit de s'en passer. Là les seuls assertions sont sur des mocks donc on se retrouve juste avec une copie de code, peu d'intérêt et cela rend le test beaucoup trop lié à du code privé. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace AppBundle\Tests\Association\UserMembership; | ||
|
|
||
| use AppBundle\Association\Model\Repository\UserRepository; | ||
| use AppBundle\Association\UserMembership\UserService; | ||
| use AppBundle\Email\Mailer\Mailer; | ||
| use AppBundle\MembershipFee\MembershipFeeService; | ||
| use PHPUnit\Framework\Attributes\Test; | ||
| use PHPUnit\Framework\TestCase; | ||
| use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; | ||
| use Symfony\Component\Routing\Generator\UrlGeneratorInterface; | ||
| use Symfony\Component\Security\Core\Exception\UserNotFoundException; | ||
|
|
||
| class UserServiceTest extends TestCase | ||
| { | ||
| /** | ||
| * Le dépôt lève une UserNotFoundException quand aucun compte ne correspond : la demande de | ||
| * nouveau mot de passe doit s'arrêter silencieusement, sans révéler que l'email est inconnu. | ||
| */ | ||
| #[Test] | ||
| public function itIgnoresAPasswordResetForAnUnknownEmail(): void | ||
| { | ||
| $userRepository = $this->createMock(UserRepository::class); | ||
| $userRepository | ||
| ->method('loadUserByEmailOrAlternateEmail') | ||
| ->willThrowException(new UserNotFoundException()); | ||
| $userRepository->expects($this->never())->method('save'); | ||
|
|
||
| $mailer = $this->createMock(Mailer::class); | ||
| $mailer->expects($this->never())->method('send'); | ||
|
|
||
| $userService = new UserService( | ||
| $userRepository, | ||
| $mailer, | ||
| $this->createStub(UrlGeneratorInterface::class), | ||
| $this->createStub(MembershipFeeService::class), | ||
| $this->createStub(UserPasswordHasherInterface::class), | ||
| ); | ||
|
|
||
| $userService->resetPasswordForEmail('aucun-compte@example.invalid'); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pas besoin de reset l'épaisseur du texte ici.