FOSUserBundle [8/15] - Email Management and Template Customisation

Опубликовано: 17 Март 2021
на канале: Code Review Videos
215
2

Full course available at https://www.codereviewvideos.com/cour...

In this video we are going to look at how FOSUserBundle email templates can be customised, and also how to use Symfony's built in features to work with emails during development.

Configuration of email during development is not specific to FOSUserBundle, so the techniques you see here can be used in any Symfony development environment.

The email template customisations are specific to FOSUserBundle, however.

Before we go further, the majority of our testing for email inside a Symfony application that uses FOSUserBundle will involve visiting the /resetting/request route. When you have visited this route and filled in the form with a valid email address, an email will be sent to the given email address containing details on how to reset your password.

As part of this process, the User entity that relates to this email address will have the $passwordRequestedAt property updated to a DateTime instance of when the password reset was requested.

This will cause you an issue during testing, as once the password_requested_at field inside your database is no longer null, you cannot re-request a password reset for 24 hours. As such, be sure to keep your database client open and set the password_requested_at field back to null before testing the Password Reset workflow.

This is exactly the sort of thing that would be better managed through an automated test :)

However, it is also worthwhile having a secondary method - a simple contact form - on your real web site to allow Users to email you / your helpdesk directly, should something have gone wrong in the process, rather than making a User of your system wait 24 hours to be able to log back in.

https://codereviewvideos.com/course/g...


Смотрите видео FOSUserBundle [8/15] - Email Management and Template Customisation онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Code Review Videos 17 Март 2021, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 215 раз и оно понравилось 2 людям.