Update configs and changelog for version 0.9.3 + additional fixes

This commit is contained in:
Maxim Kukhtenkov 2018-01-19 19:31:49 -05:00
parent 6a84d85d91
commit bcd6ab4401
5 changed files with 20 additions and 15 deletions

View File

@ -1,5 +1,5 @@
django>=1.9.0
django-rest-auth==0.9.2
django-rest-auth==0.9.3
djangorestframework>=3.7.0
django-allauth>=0.24.1
six==1.9.0

View File

@ -1,6 +1,13 @@
Changelog
=========
0.9.3
-----
- added social connect views
- added check for pre-existing accounts in social login
- prevent double-validation in LoginSerializer
- unit tests and demo project changes for Django 2.0
0.9.2
-----
- added permission classes configuration for registration

View File

@ -150,14 +150,14 @@ If you are using Twitter for your social authentication, it is a bit different s
urlpatterns += [
...,
url(r'^rest-auth/twitter/$', TwitterLogin.as_view(), name='twitter_login')
url(r'^rest-auth/twitter/connect/$', TwitterConnect.as_view(), name='twitter_connect')
]
.. note:: Starting from v0.21.0, django-allauth has dropped support for context processors. Check out http://django-allauth.readthedocs.org/en/latest/changelog.html#from-0-21-0 for more details.
Additional Social Connect Views
###############################
If you want to allow connecting existing accounts in addition to just login, you can use connect views:
If you want to allow connecting existing accounts in addition to login, you can use connect views:
.. code-block:: python
@ -182,7 +182,7 @@ In urls.py:
url(r'^rest-auth/twitter/connect/$', TwitterConnect.as_view(), name='twitter_connect')
]
You can also use additional views to check all social accounts attached to the current authenticated user and disconnect selected social accounts.
You can also use the following views to check all social accounts attached to the current authenticated user and disconnect selected social accounts:
.. code-block:: python

View File

@ -1,4 +1,5 @@
from django.http import HttpRequest
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth import get_user_model
@ -8,15 +9,19 @@ try:
get_username_max_length)
from allauth.account.adapter import get_adapter
from allauth.account.utils import setup_user_email
from allauth.socialaccount.helpers import complete_social_login
from allauth.socialaccount.models import SocialAccount
from allauth.socialaccount.providers.base import AuthProcess
except ImportError:
raise ImportError("allauth needs to be added to INSTALLED_APPS.")
from rest_framework import serializers
from requests.exceptions import HTTPError
# Import is needed only if we are using social login, in which
# case the allauth.socialaccount will be declared
if 'allauth.socialaccount' in settings.INSTALLED_APPS:
from allauth.socialaccount.helpers import complete_social_login
from allauth.socialaccount.models import SocialAccount
from allauth.socialaccount.providers.base import AuthProcess
class SocialAccountSerializer(serializers.ModelSerializer):
"""

View File

@ -322,10 +322,6 @@ class TestSocialConnectAuth(TestsMixin, TestCase):
"password2": PASS,
"email": EMAIL
}
LOGIN_DATA = {
"username": USERNAME,
"password": PASS,
}
def setUp(self):
self.init()
@ -405,9 +401,6 @@ class TestSocialConnectAuth(TestsMixin, TestCase):
self.assertIn('key', self.response.json.keys())
# Test Twitter
self.post(self.logout_url)
self.post(self.login_url, data=self.LOGIN_DATA)
resp_body = {
"id": "123123123123",
}
@ -439,7 +432,7 @@ class TestSocialConnectAuth(TestsMixin, TestCase):
# Try disconnecting accounts
self.incorrect_disconnect_url = reverse(
'social_account_disconnect', args=[999]
'social_account_disconnect', args=[999999999]
)
self.post(self.incorrect_disconnect_url, status_code=404)