mirror of
https://github.com/Tivix/django-rest-auth.git
synced 2024-11-22 17:16:34 +03:00
Merge branch 'master' into pr/130
This commit is contained in:
commit
ec91620550
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -33,6 +33,7 @@ htmlcov/
|
||||||
.cache
|
.cache
|
||||||
nosetests.xml
|
nosetests.xml
|
||||||
coverage.xml
|
coverage.xml
|
||||||
|
coverage_html
|
||||||
|
|
||||||
# Translations
|
# Translations
|
||||||
*.mo
|
*.mo
|
||||||
|
|
|
@ -106,9 +106,9 @@ TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')]
|
||||||
REST_SESSION_LOGIN = False
|
REST_SESSION_LOGIN = False
|
||||||
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
||||||
SITE_ID = 1
|
SITE_ID = 1
|
||||||
ACCOUNT_EMAIL_REQUIRED = True
|
ACCOUNT_EMAIL_REQUIRED = False
|
||||||
ACCOUNT_AUTHENTICATION_METHOD = 'username'
|
ACCOUNT_AUTHENTICATION_METHOD = 'username'
|
||||||
ACCOUNT_EMAIL_VERIFICATION = 'mandatory'
|
ACCOUNT_EMAIL_VERIFICATION = 'optional'
|
||||||
|
|
||||||
REST_FRAMEWORK = {
|
REST_FRAMEWORK = {
|
||||||
'DEFAULT_AUTHENTICATION_CLASSES': (
|
'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!-- Signup form -->
|
<!-- Signup form -->
|
||||||
<form class="form-horizontal ajax-post" role="form" action="{% url 'rest_verify_email' %}">
|
<form class="form-horizontal ajax-post" role="form" action="{% url 'rest_verify_email' %}">{% csrf_token %}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="key" class="col-sm-2 control-label">Key</label>
|
<label for="key" class="col-sm-2 control-label">Key</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!-- Signup form -->
|
<!-- Signup form -->
|
||||||
<form class="form-horizontal ajax-post" role="form" action="{% url 'rest_login' %}">
|
<form class="form-horizontal ajax-post" role="form" action="{% url 'rest_login' %}">{% csrf_token %}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="username" class="col-sm-2 control-label">Username</label>
|
<label for="username" class="col-sm-2 control-label">Username</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<!-- Signup form -->
|
<!-- Signup form -->
|
||||||
<form class="form-horizontal ajax-post" role="form" action="{% url 'rest_password_change' %}">
|
<form class="form-horizontal ajax-post" role="form" action="{% url 'rest_password_change' %}">{% csrf_token %}
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="new_password1" class="col-sm-2 control-label">Password</label>
|
<label for="new_password1" class="col-sm-2 control-label">Password</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!-- Signup form -->
|
<!-- Signup form -->
|
||||||
<form class="form-horizontal ajax-post" role="form" action="{% url 'rest_password_reset_confirm' %}">
|
<form class="form-horizontal ajax-post" role="form" action="{% url 'rest_password_reset_confirm' %}">{% csrf_token %}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="uid" class="col-sm-2 control-label">Uid</label>
|
<label for="uid" class="col-sm-2 control-label">Uid</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!-- Signup form -->
|
<!-- Signup form -->
|
||||||
<form class="form-horizontal ajax-post" role="form" action="{% url 'rest_password_reset' %}">
|
<form class="form-horizontal ajax-post" role="form" action="{% url 'rest_password_reset' %}">{% csrf_token %}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="email" class="col-sm-2 control-label">E-mail</label>
|
<label for="email" class="col-sm-2 control-label">E-mail</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!-- Signup form -->
|
<!-- Signup form -->
|
||||||
<form class="form-horizontal ajax-post" id="signup" role="form" action="{% url 'rest_register' %}">
|
<form class="form-horizontal ajax-post" id="signup" role="form" action="{% url 'rest_register' %}">{% csrf_token %}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="email" class="col-sm-2 control-label">Email</label>
|
<label for="email" class="col-sm-2 control-label">Email</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!-- Signup form -->
|
<!-- Signup form -->
|
||||||
<form class="form-horizontal" id="signup" role="form" action="{% url 'rest_user_details' %}">
|
<form class="form-horizontal" id="signup" role="form" action="{% url 'rest_user_details' %}">{% csrf_token %}
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="email" class="col-sm-2 control-label">Email</label>
|
<label for="email" class="col-sm-2 control-label">Email</label>
|
||||||
|
|
|
@ -11,7 +11,7 @@ Do these steps to make it running (ideally in virtualenv).
|
||||||
git clone https://github.com/Tivix/django-rest-auth.git
|
git clone https://github.com/Tivix/django-rest-auth.git
|
||||||
cd django-rest-auth/demo/
|
cd django-rest-auth/demo/
|
||||||
pip install -r requirements.pip
|
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
|
python manage.py runserver --settings=demo.settings
|
||||||
|
|
||||||
Now, go to ``http://127.0.0.1:8000/`` in your browser.
|
Now, go to ``http://127.0.0.1:8000/`` in your browser.
|
||||||
|
|
|
@ -70,7 +70,3 @@ INSTALLED_APPS = [
|
||||||
SECRET_KEY = "38dh*skf8sjfhs287dh&^hd8&3hdg*j2&sd"
|
SECRET_KEY = "38dh*skf8sjfhs287dh&^hd8&3hdg*j2&sd"
|
||||||
ACCOUNT_ACTIVATION_DAYS = 1
|
ACCOUNT_ACTIVATION_DAYS = 1
|
||||||
SITE_ID = 1
|
SITE_ID = 1
|
||||||
|
|
||||||
MIGRATION_MODULES = {
|
|
||||||
'authtoken': 'authtoken.migrations',
|
|
||||||
}
|
|
||||||
|
|
|
@ -223,6 +223,15 @@ class APITestCase1(TestCase, BaseAPITestCase):
|
||||||
}
|
}
|
||||||
self.post(self.login_url, data=payload, status_code=200)
|
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):
|
def test_password_reset_with_invalid_email(self):
|
||||||
get_user_model().objects.create_user(self.USERNAME, self.EMAIL, self.PASS)
|
get_user_model().objects.create_user(self.USERNAME, self.EMAIL, self.PASS)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user