Skip to content

Commit 4d9e33e

Browse files
author
Will Liu
committed
fix demo by add csrf and modify account settings
In response to Issue 116 at #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)
1 parent 4889cb5 commit 4d9e33e

File tree

8 files changed

+9
-10
lines changed

8 files changed

+9
-10
lines changed

demo/demo/settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@
106106
REST_SESSION_LOGIN = False
107107
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
108108
SITE_ID = 1
109-
ACCOUNT_EMAIL_REQUIRED = True
109+
ACCOUNT_EMAIL_REQUIRED = False
110110
ACCOUNT_AUTHENTICATION_METHOD = 'username'
111-
ACCOUNT_EMAIL_VERIFICATION = 'mandatory'
111+
ACCOUNT_EMAIL_VERIFICATION = 'optional'
112112

113113
REST_FRAMEWORK = {
114114
'DEFAULT_AUTHENTICATION_CLASSES': (

demo/templates/fragments/email_verification_form.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!-- Signup form -->
2-
<form class="form-horizontal ajax-post" role="form" action="{% url 'rest_verify_email' %}">
2+
<form class="form-horizontal ajax-post" role="form" action="{% url 'rest_verify_email' %}">{% csrf_token %}
33
<div class="form-group">
44
<label for="key" class="col-sm-2 control-label">Key</label>
55
<div class="col-sm-10">

demo/templates/fragments/login_form.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!-- Signup form -->
2-
<form class="form-horizontal ajax-post" role="form" action="{% url 'rest_login' %}">
2+
<form class="form-horizontal ajax-post" role="form" action="{% url 'rest_login' %}">{% csrf_token %}
33
<div class="form-group">
44
<label for="username" class="col-sm-2 control-label">Username</label>
55
<div class="col-sm-10">

demo/templates/fragments/password_change_form.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<!-- Signup form -->
2-
<form class="form-horizontal ajax-post" role="form" action="{% url 'rest_password_change' %}">
3-
2+
<form class="form-horizontal ajax-post" role="form" action="{% url 'rest_password_change' %}">{% csrf_token %}
43
<div class="form-group">
54
<label for="new_password1" class="col-sm-2 control-label">Password</label>
65
<div class="col-sm-10">

demo/templates/fragments/password_reset_confirm_form.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!-- Signup form -->
2-
<form class="form-horizontal ajax-post" role="form" action="{% url 'rest_password_reset_confirm' %}">
2+
<form class="form-horizontal ajax-post" role="form" action="{% url 'rest_password_reset_confirm' %}">{% csrf_token %}
33
<div class="form-group">
44
<label for="uid" class="col-sm-2 control-label">Uid</label>
55
<div class="col-sm-10">

demo/templates/fragments/password_reset_form.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!-- Signup form -->
2-
<form class="form-horizontal ajax-post" role="form" action="{% url 'rest_password_reset' %}">
2+
<form class="form-horizontal ajax-post" role="form" action="{% url 'rest_password_reset' %}">{% csrf_token %}
33
<div class="form-group">
44
<label for="email" class="col-sm-2 control-label">E-mail</label>
55
<div class="col-sm-10">

demo/templates/fragments/signup_form.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!-- Signup form -->
2-
<form class="form-horizontal ajax-post" id="signup" role="form" action="{% url 'rest_register' %}">
2+
<form class="form-horizontal ajax-post" id="signup" role="form" action="{% url 'rest_register' %}">{% csrf_token %}
33
<div class="form-group">
44
<label for="email" class="col-sm-2 control-label">Email</label>
55
<div class="col-sm-10">

demo/templates/fragments/user_details_form.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!-- Signup form -->
2-
<form class="form-horizontal" id="signup" role="form" action="{% url 'rest_user_details' %}">
2+
<form class="form-horizontal" id="signup" role="form" action="{% url 'rest_user_details' %}">{% csrf_token %}
33

44
<div class="form-group">
55
<label for="email" class="col-sm-2 control-label">Email</label>

0 commit comments

Comments
 (0)