daddl3/email_with_login_link_and_change_password

Symfony Bundle for automatic E-Mail sending with Login Link

0.0.3 2024-02-07 00:10 UTC

This package is auto-updated.

Last update: 2024-05-06 23:45:36 UTC


README

Pipeline Status Version

Email Login When Creating A User

Send an E-Mail with a Login Link

Getting started

This bundle helps you to send an E-Mail to a User automatically

Installation

$ composer requ daddl3/email_with_login_link

Config

This config defines how long the link is valid. The signature_properties has to be in your UserInterface The Field 'email' and 'id' in your UserInterface is needed. The Field 'fullname' is optional.

Your provider class has to have getters and setters like this

$user
    ->setPassword($encodedPassword)
    ->setSetOwnPassword(true);

you can overwrite this default values in the security.yaml

security:
  firewalls:
    main:
      login_link:
        check_route: login_check
        lifetime: 86400 // 1 day
        signature_properties: [ 'id', 'email' ]
Information

An example to set this email

$this->eventDispatcher->dispatch(
    new EmailOnCreationEvent(
        providerClass: App\Entity\User,
        sender: new Adress('email@example.de', 'Mr. Daddl3'),
        subject: 'An User was created',
        cc: 'email@example.de',
        bcc: 'email@example.de',
        replyTo: new Address('email@example.de'),
        priority: Email::PRIORITY_HIGH
    )
);

Have a look to the types.

If you want to overwrite the twig file use the normal bundle overwrite for it:

  • templates
    • bundles
      • EmailLoginWhenCreatingAUser
        • email.html.twig

I add the event to the rendering, so you can use this in your twig file.