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

Extra context for email rendering and dynamic email from address #157

Open
g3rb3n opened this issue Apr 30, 2022 · 2 comments · May be fixed by #158
Open

Extra context for email rendering and dynamic email from address #157

g3rb3n opened this issue Apr 30, 2022 · 2 comments · May be fixed by #158

Comments

@g3rb3n
Copy link
Contributor

g3rb3n commented Apr 30, 2022

Is your feature request related to a problem? Please describe.
For sending mfa code emails in a multi Site setup. we need to be able to send mails with more context data, like site.name. The current implementation does not pass the request object to the backend which makes it impossible to use the request in rendering the email templates.

Describe the solution you'd like
Pass the request object to the backend. Allow for implementing get_context in subclass. Pass the extra context to the template rendering.

Describe alternatives you've considered
Write a separate backend for each site.

Additional context
None

@wmaciejewskimer wmaciejewskimer linked a pull request May 30, 2022 that will close this issue
@wmaciejewskimer
Copy link
Collaborator

This is just a basic email method, you can write your own email backend that meets your requirements

@g3rb3n
Copy link
Contributor Author

g3rb3n commented Mar 7, 2023

Just writing a custom backend is not enough, since the backend needs to know on which site the request came in. If someone is hosting e.g. site aaa.xyz and site bbb.xyz on the same process, how should the email backend know that the request came in on aaa.xyz of bbb.xyz? The only way to do this currently, is to setup two different process with each having it's own settings.

See #158 . This includes a modified email backend, but also some minor changes in trench.backends.base and trench.views.base.

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 a pull request may close this issue.

2 participants