tangentlabs/django-oscar — pull request #306 by elbaschid (2012-09-19 01:49:48+00:00)
Title: handle password resets using communication events

All communication events in Oscar are handled using ``CommunicationEventType``s and the ``Dispatcher`` except for emails send out when resetting a users password. This uses the ``password_reset`` view function provided in ``django.contrib.auth.views``.

This causes an issue with the context variable ``static_base_url`` which is provided in the email template for each ``CommunicationEventType``. Since this provides access to static content (and the required full URLs for email content) I suggest that the context of the password reset email template is extended to include this variable as well. Not being able to match the design of emails in (all) other templates might cause the user to assume this email is illegitimate, worrying about their account safety.

The solution I provide in this pull request is a custom ``PasswordResetForm`` that replaces the direct handling of the email template and sending the email with using a new ``CommunicationEventType`` named ``PASSWORD_RESET`` and handling the sending and rendering through the Oscar ``Dispatcher``. This adds the ``static_base_url`` to the email's context and align the handling with the way Oscar handles emails everywhere else.