mirror of
https://github.com/Tivix/django-rest-auth.git
synced 2024-12-01 21:33:45 +03:00
Test za DRF3
This commit is contained in:
parent
802de89ed7
commit
7984cb5f00
|
@ -44,17 +44,20 @@ INSTALLED_APPS = (
|
|||
'django.contrib.staticfiles',
|
||||
'django.contrib.sites',
|
||||
|
||||
'corsheaders',
|
||||
|
||||
'rest_framework',
|
||||
'rest_framework.authtoken',
|
||||
'rest_auth',
|
||||
|
||||
'allauth',
|
||||
'allauth.account',
|
||||
'rest_auth.registration',
|
||||
# 'allauth',
|
||||
# 'allauth.account',
|
||||
# 'rest_auth.registration',
|
||||
)
|
||||
|
||||
MIDDLEWARE_CLASSES = (
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'corsheaders.middleware.CorsMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
|
@ -105,3 +108,12 @@ SITE_ID = 1
|
|||
ACCOUNT_EMAIL_REQUIRED = True
|
||||
ACCOUNT_AUTHENTICATION_METHOD = 'email'
|
||||
ACCOUNT_EMAIL_VERIFICATION = 'mandatory'
|
||||
|
||||
CORS_ORIGIN_ALLOW_ALL = True
|
||||
|
||||
REST_FRAMEWORK = {
|
||||
'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||
'rest_framework.authentication.SessionAuthentication',
|
||||
'rest_framework.authentication.TokenAuthentication',
|
||||
)
|
||||
}
|
|
@ -33,5 +33,6 @@ urlpatterns = patterns('',
|
|||
|
||||
url(r'^rest-auth/', include('rest_auth.urls')),
|
||||
url(r'^rest-auth/registration/', include('rest_auth.registration.urls')),
|
||||
url(r'^account/', include('allauth.urls')),
|
||||
url(r'^admin/', include(admin.site.urls)),
|
||||
)
|
||||
|
|
|
@ -31,7 +31,7 @@ class Login(GenericAPIView):
|
|||
response_serializer = TokenSerializer
|
||||
|
||||
def login(self):
|
||||
self.user = self.serializer.object['user']
|
||||
self.user = self.serializer.validated_data['user']
|
||||
self.token, created = self.token_model.objects.get_or_create(
|
||||
user=self.user)
|
||||
if getattr(settings, 'REST_SESSION_LOGIN', True):
|
||||
|
|
Loading…
Reference in New Issue
Block a user