#30499: PasswordResetView should be allowed to set `domain_override`
-------------------------------------------+------------------------
Reporter: Mattia Procopio | Owner: nobody
Type: New feature | Status: new
Component: Uncategorized | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------------+------------------------
Actually if the domain of the link sent within the mail needs to be
overridden, the view `form_valid` method should be replaced or the view
should subclass an own instance of PasswordContextMixin.
I think allowing to inject a custom domain from `urls.py` would help with
DRY in this case as the new domain can be passed when declaring
`PasswordResetView.as_view(domain_override="mynew.domain.com"`)
I am thinking of adding simply domain_override = None as new class
attribute and adding it to opts:
{{{
class PasswordResetView(PasswordContextMixin, FormView):
...
domain_override = None
def form_valid(self, form):
opts = {
'use_https': self.request.is_secure(),
'token_generator': self.token_generator,
'from_email': self.from_email,
'email_template_name': self.email_template_name,
'subject_template_name': self.subject_template_name,
'request': self.request,
'html_email_template_name': self.html_email_template_name,
'extra_email_context': self.extra_email_context,
'domain_override': self.domain_override,
}
form.save(**opts)
return super().form_valid(form)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30499>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/054.3cf108063bb8422deb82bc2777ad8ecb%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.