diff --git a/.gitignore b/.gitignore index 8a04b95..85446ba 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,7 @@ htmlcov/ .cache nosetests.xml coverage.xml +coverage_html # Translations *.mo diff --git a/demo/demo/settings.py b/demo/demo/settings.py index c82f703..f559d5c 100644 --- a/demo/demo/settings.py +++ b/demo/demo/settings.py @@ -106,9 +106,9 @@ TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')] REST_SESSION_LOGIN = False EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' SITE_ID = 1 -ACCOUNT_EMAIL_REQUIRED = True +ACCOUNT_EMAIL_REQUIRED = False ACCOUNT_AUTHENTICATION_METHOD = 'username' -ACCOUNT_EMAIL_VERIFICATION = 'mandatory' +ACCOUNT_EMAIL_VERIFICATION = 'optional' REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': ( diff --git a/demo/templates/fragments/email_verification_form.html b/demo/templates/fragments/email_verification_form.html index 2298d0e..a718e0b 100644 --- a/demo/templates/fragments/email_verification_form.html +++ b/demo/templates/fragments/email_verification_form.html @@ -1,5 +1,5 @@ -
+{% csrf_token %}
diff --git a/demo/templates/fragments/login_form.html b/demo/templates/fragments/login_form.html index ee02b53..46aba62 100644 --- a/demo/templates/fragments/login_form.html +++ b/demo/templates/fragments/login_form.html @@ -1,5 +1,5 @@ - +{% csrf_token %}
diff --git a/demo/templates/fragments/password_change_form.html b/demo/templates/fragments/password_change_form.html index 9e64ea4..c8dfda5 100644 --- a/demo/templates/fragments/password_change_form.html +++ b/demo/templates/fragments/password_change_form.html @@ -1,6 +1,5 @@ - - +{% csrf_token %}
diff --git a/demo/templates/fragments/password_reset_confirm_form.html b/demo/templates/fragments/password_reset_confirm_form.html index 973b05d..5a9c395 100644 --- a/demo/templates/fragments/password_reset_confirm_form.html +++ b/demo/templates/fragments/password_reset_confirm_form.html @@ -1,5 +1,5 @@ - +{% csrf_token %}
diff --git a/demo/templates/fragments/password_reset_form.html b/demo/templates/fragments/password_reset_form.html index 6840193..0f61344 100644 --- a/demo/templates/fragments/password_reset_form.html +++ b/demo/templates/fragments/password_reset_form.html @@ -1,5 +1,5 @@ - +{% csrf_token %}
diff --git a/demo/templates/fragments/signup_form.html b/demo/templates/fragments/signup_form.html index 9a7e43e..d60b99b 100644 --- a/demo/templates/fragments/signup_form.html +++ b/demo/templates/fragments/signup_form.html @@ -1,5 +1,5 @@ - +{% csrf_token %}
diff --git a/demo/templates/fragments/user_details_form.html b/demo/templates/fragments/user_details_form.html index 405403b..7fafc0a 100644 --- a/demo/templates/fragments/user_details_form.html +++ b/demo/templates/fragments/user_details_form.html @@ -1,5 +1,5 @@ - +{% csrf_token %}
diff --git a/docs/demo.rst b/docs/demo.rst index ed74750..877ca33 100644 --- a/docs/demo.rst +++ b/docs/demo.rst @@ -11,7 +11,7 @@ Do these steps to make it running (ideally in virtualenv). git clone https://github.com/Tivix/django-rest-auth.git cd django-rest-auth/demo/ pip install -r requirements.pip - python manage.py syncdb --settings=demo.settings --noinput + python manage.py migrate --settings=demo.settings --noinput python manage.py runserver --settings=demo.settings Now, go to ``http://127.0.0.1:8000/`` in your browser. diff --git a/rest_auth/tests/settings.py b/rest_auth/tests/settings.py index 5c7a940..b09b496 100644 --- a/rest_auth/tests/settings.py +++ b/rest_auth/tests/settings.py @@ -70,7 +70,3 @@ INSTALLED_APPS = [ SECRET_KEY = "38dh*skf8sjfhs287dh&^hd8&3hdg*j2&sd" ACCOUNT_ACTIVATION_DAYS = 1 SITE_ID = 1 - -MIGRATION_MODULES = { - 'authtoken': 'authtoken.migrations', -} diff --git a/rest_auth/tests/test_api.py b/rest_auth/tests/test_api.py index d5411d6..fef9fdf 100644 --- a/rest_auth/tests/test_api.py +++ b/rest_auth/tests/test_api.py @@ -223,6 +223,15 @@ class APITestCase1(TestCase, BaseAPITestCase): } self.post(self.login_url, data=payload, status_code=200) + def test_password_reset_with_email_in_different_case(self): + user = get_user_model().objects.create_user(self.USERNAME, self.EMAIL.lower(), self.PASS) + + # call password reset in upper case + mail_count = len(mail.outbox) + payload = {'email': self.EMAIL.upper()} + self.post(self.password_reset_url, data=payload, status_code=200) + self.assertEqual(len(mail.outbox), mail_count + 1) + def test_password_reset_with_invalid_email(self): get_user_model().objects.create_user(self.USERNAME, self.EMAIL, self.PASS)