Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add django-allauth to project

Artur Smęt1c1e15d1f40e
diff --git a/requirements.in b/requirements.in
index 034f1ecfe7..6a455cb71d 100644
--- a/requirements.in
+++ b/requirements.in
@@ -4,6 +4,7 @@ boto
Django>=1.8,!=1.8.6
dj_database_url>=0.3.0
dj_email_url>=0.0.4
+django-allauth>=0.28.0
django-bootstrap3>=6.2.0
django-cache-url>=1.0.0
django-countries>=3.4
diff --git a/requirements.txt b/requirements.txt
index a8ea3aaa8c..387940b125 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -15,6 +15,7 @@ cssutils==1.0.1 # via premailer
dj-database-url==0.4.1
dj-email-url==0.0.10
django-absolute==0.3 # via django-emailit
+django-allauth==0.28.0
django-bootstrap3==7.1.0
django-cache-url==1.3.0
django-countries==4.0
@@ -30,18 +31,22 @@ django-selectable==0.9.0
django-storages==1.5.1
django-versatileimagefield==1.6
django-webpack-loader==0.4.1
-Django==1.10.3 # via django-absolute, django-emailit, django-model-utils, django-payments, django-prices, django-prices-openexchangerates, jsonfield
+Django==1.10.3 # via django-absolute, django-allauth, django-emailit, django-model-utils, django-payments, django-prices, django-prices-openexchangerates, jsonfield
djangorestframework==3.5.2
+enum34==1.1.6 # via cryptography
fake-factory==0.7.2
+funcsigs==1.0.2 # via mock
google-i18n-address==2.0.0
google-measurement-protocol==0.1.6
idna==2.1 # via cryptography
+ipaddress==1.0.17 # via cryptography, fake-factory, maxminddb
jsonfield==1.0.3
lxml==3.6.4 # via premailer
Markdown==2.6.7
maxminddb-geolite2==2015.708
maxminddb==1.2.1
mock==2.0.0
+oauthlib==2.0.0 # via requests-oauthlib
pbr==1.10.0 # via mock
Pillow==3.4.2 # via django-versatileimagefield
premailer==3.0.1 # via django-emailit
@@ -55,8 +60,10 @@ PyJWT==1.4.2 # via django-payments
pytest-django==3.0.0
pytest==3.0.3
python-dateutil==2.5.3 # via fake-factory
+python-openid==2.2.5 # via django-allauth
pytz==2016.7 # via babel
redis==2.10.5 # via django-redis
+requests-oauthlib==0.7.0 # via django-allauth
requests==2.11.1
satchless==1.1.3
six==1.10.0 # via cryptography, fake-factory, mock, purl, python-dateutil
diff --git a/saleor/settings.py b/saleor/settings.py
index cea7991910..0e480cdf31 100644
--- a/saleor/settings.py
+++ b/saleor/settings.py
@@ -165,7 +165,13 @@ INSTALLED_APPS = [
'selectable',
'materializecssform',
'rest_framework',
- 'webpack_loader'
+ 'webpack_loader',
+ 'allauth',
+ 'allauth.account',
+ 'allauth.socialaccount',
+ 'allauth.socialaccount.providers.facebook',
+ 'allauth.socialaccount.providers.github',
+ 'allauth.socialaccount.providers.google',
]
LOGGING = {
@@ -215,15 +221,9 @@ LOGGING = {
}
}
-AUTHENTICATION_BACKENDS = (
- 'saleor.registration.backends.EmailPasswordBackend',
- 'saleor.registration.backends.ExternalLoginBackend',
- 'saleor.registration.backends.TrivialBackend'
-)
-
AUTH_USER_MODEL = 'userprofile.User'
-LOGIN_URL = '/account/login'
+LOGIN_URL = '/accounts/login'
DEFAULT_COUNTRY = 'US'
DEFAULT_CURRENCY = 'USD'
@@ -306,3 +306,13 @@ WEBPACK_LOADER = {
'IGNORE': [
r'.+\.hot-update\.js',
r'.+\.map']}}
+
+
+ACCOUNT_AUTHENTICATION_METHOD = 'email'
+ACCOUNT_EMAIL_REQUIRED = True
+ACCOUNT_USER_MODEL_USERNAME_FIELD = None
+ACCOUNT_EMAIL_VERIFICATION = 'mandatory'
+ACCOUNT_USERNAME_REQUIRED = False
+# ACCOUNT_ADAPTER = 'saleor.userprofile.account_adapter.SaleorAccountAdapter'
+SOCIALACCOUNT_EMAIL_VERIFICATION = False
+ACCOUNT_LOGOUT_ON_GET = True
diff --git a/saleor/urls.py b/saleor/urls.py
index 82e80dfc29..8b399d3b13 100644
--- a/saleor/urls.py
+++ b/saleor/urls.py
@@ -20,7 +20,7 @@ admin.autodiscover()
urlpatterns = [
url(r'^', include(core_urls)),
- url(r'^account/', include(registration_urls, namespace='registration')),
+ url(r'^accounts/', include('allauth.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^cart/', include(cart_urls, namespace='cart')),
url(r'^checkout/', include(checkout_urls, namespace='checkout')),