Skip to content
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

Add styled default email templates #6912

Merged
merged 4 commits into from
Feb 23, 2024
Merged

Conversation

scotttrinh
Copy link
Contributor

Used MJML to produce some reasonable email templates based on some designs provided by Roman. I considered basically translating MJML into "components" but there are some tricky ways they wrap certain kinds of elements. Probably still doable, but I ran out of patience.

Here is the general shape (showing the magic link email)

image

Copy link
Member

@1st1 1st1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good conceptually, but I wasn't looking at the code closely.

Comment on lines +413 to +430
<td style="width: 150px">
<img
alt="
{f'{app_name} logo' if app_name else ''}
"
height="150"
src="{logo_url}"
style="
border: none;
display: block;
outline: none;
text-decoration: none;
height: 150px;
width: 100%;
font-size: 13px;
"
width="150"
/>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went with 150x150 here for lack of a better idea. Another option is to have the width set to 150 and have the height be auto which would preserve the aspect ratio. We don't give much guidance to the developer about aspect ratio and size, and I think we should.

Even though we don't actually use this parameter, we pass it from
callers via kwargs, so it's easier to just keep it.
@emrosenf
Copy link

emrosenf commented Feb 23, 2024

Would you consider exposing an option for the user to retrieve the link and send their own transactional e-mails so that they can be styled by the user?

@scotttrinh
Copy link
Contributor Author

@emrosenf

Would you consider exposing an option for the user to retrieve the link and send their own transactional e-mails so that they can be styled by the user?

We have a near term plan to allow setting the email templates (keep an eye on #6868) that would allow totally custom emails via your configured SMTP server, but we're likely going to still maintain the flows within the auth server/extension rather than exposing an API that you could piece something together with to send your own emails.

In some senses, all of these flows are something that you could replace with your own bespoke flows since all of the data lives in your database. If you store the signing key securely on your server you could issue your own auth tokens, so you could implement your own password recovery and email verification flows directly. A bit of a heavy lift, but totally doable since the server code we're including here isn't privileged in any way that your own code isn't.

@scotttrinh scotttrinh merged commit fed6c15 into master Feb 23, 2024
24 checks passed
@scotttrinh scotttrinh deleted the auth-default-email-templates branch February 23, 2024 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants