-
Notifications
You must be signed in to change notification settings - Fork 24
Allow more customisation of account verification email #62
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
Conversation
* Use plain text email by default
* Set EMAIL_SUBJECT_TEMPLATE on VerifyEmailMixin * Refactor send_validation_email to allow easier testing
* Add _get_email_context helper method * Simplify _get_email_kwargs method
* Avoid duplicating work in test__email_context and test__get_email_kwargs
* Allow the email templates used by send_validation_email to be overriden or disabled. * Allow the context provided to the email templates to be extended. * Add a docstring to send_validation_email.
|
@adam-incuna @meshy Review? |
user_management/models/mixins.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The underscore suggests that this should not be lightly overridden. Is that the case?
* Make email_kwargs part of the public api * Standardise naming to match email_context
|
@adam-incuna @meshy Updated. |
user_management/models/mixins.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{{ domain }} ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe template isn't the best word - I'm not referring to a django template here. EMAIL_SUBJECT_TEMPLATE is a string that is used with .format in get_email_subject.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh cool :) maybe specify that?
|
Nice one, this looks like a really useful improvement! |
|
👍 happy to merge if @meshy is! |
user_management/models/mixins.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be return {...}
|
Looks good other than my comment about the return statement. |
Allow more customisation of account verification email
In
VerifyEmailMixin.send_validation_emailwe hard-code the email subject. We also assume only a html email is sent.