From 554ce1bafdd546e31e9abb3be3d74c4e8ede8c53 Mon Sep 17 00:00:00 2001 From: Mateusz Sikora Date: Fri, 14 Aug 2015 15:12:08 +0200 Subject: [PATCH 1/8] Update .travis.yml --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 53c2a44..84a420e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,8 @@ env: - DJANGO=1.8 matrix: exclude: + - python: "2.6" + env: DJANGO=1.5.12 - python: "2.6" env: DJANGO=1.7.7 - python: "2.6" From 27e0f223edb6c559a5ebcba2b92238e4fc9863f9 Mon Sep 17 00:00:00 2001 From: Mateusz Sikora Date: Fri, 14 Aug 2015 15:20:20 +0200 Subject: [PATCH 2/8] Update README.rst --- README.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.rst b/README.rst index 1e670d7..1471cce 100644 --- a/README.rst +++ b/README.rst @@ -9,10 +9,6 @@ Welcome to django-rest-auth :target: https://coveralls.io/r/Tivix/django-rest-auth?branch=master -.. image:: https://requires.io/github/Tivix/django-rest-auth/requirements.png?branch=master - :target: https://requires.io/github/Tivix/django-rest-auth/requirements/?branch=master - - .. image:: https://readthedocs.org/projects/django-rest-auth/badge/?version=latest :target: https://readthedocs.org/projects/django-rest-auth/?badge=latest From ac60198e6a177a8055c1a55bfb198f569b898a31 Mon Sep 17 00:00:00 2001 From: Philippe Luickx Date: Mon, 17 Aug 2015 13:34:59 +0300 Subject: [PATCH 3/8] SocialLoginSerializer allow_blank fix --- rest_auth/registration/serializers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rest_auth/registration/serializers.py b/rest_auth/registration/serializers.py index f5c444e..48d2963 100644 --- a/rest_auth/registration/serializers.py +++ b/rest_auth/registration/serializers.py @@ -10,8 +10,8 @@ except ImportError: class SocialLoginSerializer(serializers.Serializer): - access_token = serializers.CharField(required=False) - code = serializers.CharField(required=False) + access_token = serializers.CharField(required=False, allow_blank=True) + code = serializers.CharField(required=False, allow_blank=True) def _get_request(self): request = self.context.get('request') From b6b43c1c020bea0ce65ba1fdceed06aeb7af47a2 Mon Sep 17 00:00:00 2001 From: Philippe Luickx Date: Mon, 17 Aug 2015 13:35:20 +0300 Subject: [PATCH 4/8] LoginSerializer allow_blank fix --- rest_auth/serializers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rest_auth/serializers.py b/rest_auth/serializers.py index 9cfb6b9..2b671da 100644 --- a/rest_auth/serializers.py +++ b/rest_auth/serializers.py @@ -15,8 +15,8 @@ from rest_framework.exceptions import ValidationError class LoginSerializer(serializers.Serializer): - username = serializers.CharField(required=False) - email = serializers.EmailField(required=False) + username = serializers.CharField(required=False, allow_blank=True) + email = serializers.EmailField(required=False, allow_blank=True) password = serializers.CharField(style={'input_type': 'password'}) def validate(self, attrs): From 2a2d6c3a4ded504d7da153125bb618240e8544f9 Mon Sep 17 00:00:00 2001 From: Mateusz Sikora Date: Thu, 20 Aug 2015 11:28:45 +0200 Subject: [PATCH 5/8] version 0.5.0 --- demo/requirements.pip | 2 +- docs/changelog.rst | 7 +++++++ setup.py | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/demo/requirements.pip b/demo/requirements.pip index 2583a95..c836413 100644 --- a/demo/requirements.pip +++ b/demo/requirements.pip @@ -1,4 +1,4 @@ django>=1.5.0 -django-rest-auth==0.4.0 +django-rest-auth==0.5.0 django-allauth==0.19.1 six==1.9.0 diff --git a/docs/changelog.rst b/docs/changelog.rst index cbe9962..8807029 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,6 +1,13 @@ Changelog ========= +0.5.0 +----- +- replaced request.DATA with request.data for compatibility with DRF 3.2 +- authorization codes for social login +- view classes rename (appended "View" to all of them) +- bugfixes + 0.4.0 ----- - Django 1.8 compatiblity fixes diff --git a/setup.py b/setup.py index e3400d6..90b43e4 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ f.close() setup( name='django-rest-auth', - version='0.4.0', + version='0.5.0', author='Sumit Chachra', author_email='chachra@tivix.com', url='http://github.com/Tivix/django-rest-auth', From 8c29bb60cbbf7c8d5cbecd6e81caf270da6f7832 Mon Sep 17 00:00:00 2001 From: Nick Spacek Date: Thu, 1 Oct 2015 09:51:25 -0300 Subject: [PATCH 6/8] Adds check for optional deps in INSTALLED_APPS Previously the serializers.py file relied solely on the presence of allauth.socialaccount in the PYTHON_PATH to determine if its use was required. This adds another check in the Django INSTALLED_APPS for the allauth.socialaccount app, and then continues with the import if the app has been added. --- rest_auth/registration/serializers.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rest_auth/registration/serializers.py b/rest_auth/registration/serializers.py index 48d2963..389c535 100644 --- a/rest_auth/registration/serializers.py +++ b/rest_auth/registration/serializers.py @@ -4,7 +4,10 @@ from requests.exceptions import HTTPError # Import is needed only if we are using social login, in which # case the allauth.socialaccount will be declared try: + apps.get_app_config('allauth.socialaccount') from allauth.socialaccount.helpers import complete_social_login +except LookupError: + pass except ImportError: pass From 456b6b34de764bc73ac7ee20d6a1034645e4e90f Mon Sep 17 00:00:00 2001 From: mario Date: Sun, 4 Oct 2015 12:41:07 +0200 Subject: [PATCH 7/8] Fix the optional deps for `allauth.socialaccount` --- rest_auth/registration/serializers.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rest_auth/registration/serializers.py b/rest_auth/registration/serializers.py index 389c535..5f5efd6 100644 --- a/rest_auth/registration/serializers.py +++ b/rest_auth/registration/serializers.py @@ -1,15 +1,17 @@ from django.http import HttpRequest +from django.conf import settings + 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 try: - apps.get_app_config('allauth.socialaccount') from allauth.socialaccount.helpers import complete_social_login -except LookupError: - pass except ImportError: - pass + raise ImportError('allauth.socialaccount needs to be installed.') + +if 'allauth.socialaccount' not in settings.INSTALLED_APPS: + raise ImportError('allauth.socialaccount needs to be added to INSTALLED_APPS.') class SocialLoginSerializer(serializers.Serializer): From 632db515019f98785fdf3f2d6fbe3c112931e90b Mon Sep 17 00:00:00 2001 From: Dmitry Nazarov Date: Fri, 9 Oct 2015 16:48:01 +0300 Subject: [PATCH 8/8] It is admitted as bad style to catch any exception: in that case you can not say what is the reason of crash when it happens. Also there is no need to check for exception here, if you just want to cut off anonymous users --- rest_auth/views.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/rest_auth/views.py b/rest_auth/views.py index d789ac4..d335531 100644 --- a/rest_auth/views.py +++ b/rest_auth/views.py @@ -68,10 +68,8 @@ class LogoutView(APIView): permission_classes = (AllowAny,) def post(self, request): - try: + if not request.user.is_anonymous(): request.user.auth_token.delete() - except: - pass logout(request)