Skip to content

Commit bcd6ab4

Browse files
committed
Update configs and changelog for version 0.9.3 + additional fixes
1 parent 6a84d85 commit bcd6ab4

File tree

5 files changed

+20
-15
lines changed

5 files changed

+20
-15
lines changed

demo/requirements.pip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
django>=1.9.0
2-
django-rest-auth==0.9.2
2+
django-rest-auth==0.9.3
33
djangorestframework>=3.7.0
44
django-allauth>=0.24.1
55
six==1.9.0

docs/changelog.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
Changelog
22
=========
33

4+
0.9.3
5+
-----
6+
- added social connect views
7+
- added check for pre-existing accounts in social login
8+
- prevent double-validation in LoginSerializer
9+
- unit tests and demo project changes for Django 2.0
10+
411
0.9.2
512
-----
613
- added permission classes configuration for registration

docs/installation.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,14 @@ If you are using Twitter for your social authentication, it is a bit different s
150150
urlpatterns += [
151151
...,
152152
url(r'^rest-auth/twitter/$', TwitterLogin.as_view(), name='twitter_login')
153-
url(r'^rest-auth/twitter/connect/$', TwitterConnect.as_view(), name='twitter_connect')
154153
]
154+
155155
.. 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.
156156

157157
Additional Social Connect Views
158158
###############################
159159

160-
If you want to allow connecting existing accounts in addition to just login, you can use connect views:
160+
If you want to allow connecting existing accounts in addition to login, you can use connect views:
161161

162162
.. code-block:: python
163163
@@ -182,7 +182,7 @@ In urls.py:
182182
url(r'^rest-auth/twitter/connect/$', TwitterConnect.as_view(), name='twitter_connect')
183183
]
184184
185-
You can also use additional views to check all social accounts attached to the current authenticated user and disconnect selected social accounts.
185+
You can also use the following views to check all social accounts attached to the current authenticated user and disconnect selected social accounts:
186186

187187
.. code-block:: python
188188

rest_auth/registration/serializers.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from django.http import HttpRequest
2+
from django.conf import settings
23
from django.utils.translation import ugettext_lazy as _
34
from django.contrib.auth import get_user_model
45

@@ -8,15 +9,19 @@
89
get_username_max_length)
910
from allauth.account.adapter import get_adapter
1011
from allauth.account.utils import setup_user_email
11-
from allauth.socialaccount.helpers import complete_social_login
12-
from allauth.socialaccount.models import SocialAccount
13-
from allauth.socialaccount.providers.base import AuthProcess
1412
except ImportError:
1513
raise ImportError("allauth needs to be added to INSTALLED_APPS.")
1614

1715
from rest_framework import serializers
1816
from requests.exceptions import HTTPError
1917

18+
# Import is needed only if we are using social login, in which
19+
# case the allauth.socialaccount will be declared
20+
if 'allauth.socialaccount' in settings.INSTALLED_APPS:
21+
from allauth.socialaccount.helpers import complete_social_login
22+
from allauth.socialaccount.models import SocialAccount
23+
from allauth.socialaccount.providers.base import AuthProcess
24+
2025

2126
class SocialAccountSerializer(serializers.ModelSerializer):
2227
"""

rest_auth/tests/test_social.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -322,10 +322,6 @@ class TestSocialConnectAuth(TestsMixin, TestCase):
322322
"password2": PASS,
323323
"email": EMAIL
324324
}
325-
LOGIN_DATA = {
326-
"username": USERNAME,
327-
"password": PASS,
328-
}
329325

330326
def setUp(self):
331327
self.init()
@@ -405,9 +401,6 @@ def test_social_connect(self):
405401
self.assertIn('key', self.response.json.keys())
406402

407403
# Test Twitter
408-
self.post(self.logout_url)
409-
self.post(self.login_url, data=self.LOGIN_DATA)
410-
411404
resp_body = {
412405
"id": "123123123123",
413406
}
@@ -439,7 +432,7 @@ def test_social_connect(self):
439432

440433
# Try disconnecting accounts
441434
self.incorrect_disconnect_url = reverse(
442-
'social_account_disconnect', args=[999]
435+
'social_account_disconnect', args=[999999999]
443436
)
444437
self.post(self.incorrect_disconnect_url, status_code=404)
445438

0 commit comments

Comments
 (0)