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
Requires
- php: ^8.3
- doctrine/annotations: ^2
- doctrine/doctrine-bundle: ^2.5
- doctrine/doctrine-migrations-bundle: ^3.2
- doctrine/orm: ^2.11 | ^3
- symfony/config: ^6.0 | ^7.0
- symfony/dependency-injection: ^6.0 | ^7.0
- symfony/form: ^6.3 | ^7.0
- symfony/framework-bundle: ^6.0 | ^7.0
- symfony/mailer: ^6.3 | ^7.0
- symfony/security-bundle: ^6.3 | ^7.0
- symfony/translation: ^6.3 | ^7.0
- symfony/twig-bundle: ^6.0 | ^7.0
- symfony/validator: ^6.3 | ^7.0
- symfony/yaml: ^6.3 | ^7.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.17
- roave/security-advisories: dev-latest
README
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
- EmailLoginWhenCreatingAUser
- bundles
I add the event to the rendering, so you can use this in your twig file.