From 4d9e33e9a82082c12358c10b87a6ffd4dffad0b2 Mon Sep 17 00:00:00 2001 From: Will Liu Date: Mon, 21 Dec 2015 16:32:53 -0500 Subject: [PATCH] fix demo by add csrf and modify account settings In response to Issue 116 at https://github.com/Tivix/django-rest-auth/issues/116 * Add csrf_token tags on demo templates (was returning CSRF page) * Update settings file for the demo login (was returning message that email was required when template only shows username and password fields) --- demo/demo/settings.py | 4 ++-- demo/templates/fragments/email_verification_form.html | 2 +- demo/templates/fragments/login_form.html | 2 +- demo/templates/fragments/password_change_form.html | 3 +-- demo/templates/fragments/password_reset_confirm_form.html | 2 +- demo/templates/fragments/password_reset_form.html | 2 +- demo/templates/fragments/signup_form.html | 2 +- demo/templates/fragments/user_details_form.html | 2 +- 8 files changed, 9 insertions(+), 10 deletions(-) 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 %}