Skip to content

Save user after sending the email #8

@harshitsinghai77

Description

@harshitsinghai77

Error while sending the email results in data being saved in the database and no email is sent to the person. This creates bad entry in the database.

It would be better to first send the email and then save the entry in the database.

https://github.com/izdwuut/fastapi-registration-tutorial/blob/main/routers/auth.py

await user.save()    
Mailer.send_confirmation_message(confirmation["token"], form_data.email)

swaping the statement would be a good idea.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions