Skip to content
Snippets Groups Projects
Unverified Commit be58070d authored by Fredrik Jonsson's avatar Fredrik Jonsson Committed by GitHub
Browse files

Merge pull request #618 from OpenTechFund/bugfix/539-incorrect-site-password-reset

Make sure the reset url is the correct site from the request
parents 3b2ffa7d 9f3fd9cc
No related branches found
No related tags found
No related merge requests found
{% load i18n wagtailadmin_tags %}{% base_url_setting as base_url %}
{% trans "Please follow the link below to reset your password:" %}
{% if site.root_url %}{{ site.root_url }}{% else %}{{ base_url }}{% endif %}{% url 'users:password_reset_confirm' uidb64=uid token=token %}
{{ protocol }}://{{ domain }}{% url 'users:password_reset_confirm' uidb64=uid token=token %}
{% if user.USERNAME_FIELD != "email" %}
{% trans "Your username (in case you've forgotten):" %} {{ user.get_username }}
......
from django.core import mail
from django.test import override_settings, TestCase
from django.urls import reverse
from opentech.apply.utils.testing.tests import BaseViewTestCase
from .factories import OAuthUserFactory, StaffFactory, UserFactory
......@@ -44,3 +46,15 @@ class TestStaffProfileView(BaseTestProfielView):
def test_can_set_slack_name(self):
response = self.client.get(self.url, follow=True)
self.assertContains(response, 'Slack name')
class TestPasswordReset(BaseViewTestCase):
user_factory = UserFactory
url_name = 'users:{}'
base_view_name = 'password_reset'
def test_recieves_email(self):
response = self.post_page(None, data={'email': self.user.email})
self.assertRedirects(response, self.url(None, view_name='password_reset_done'))
self.assertEqual(len(mail.outbox), 1)
self.assertIn('https://testserver/account/password/reset/confirm', mail.outbox[0].body)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment