Skip to content
Snippets Groups Projects
Commit c3421af6 authored by Barnabás Czémán's avatar Barnabás Czémán
Browse files

Add create profile on first login

parent 8bbf6eda
No related branches found
No related tags found
No related merge requests found
from django.core import exceptions
from . import models
def create_profile(backend, user, response, *args, **kwargs):
if backend.name == 'authsch':
try:
user.profile
except exceptions.ObjectDoesNotExist:
models.Profile.objects.create(user=user)
...@@ -115,6 +115,19 @@ AUTHENTICATION_BACKENDS = [ ...@@ -115,6 +115,19 @@ AUTHENTICATION_BACKENDS = [
'django.contrib.auth.backends.ModelBackend', 'django.contrib.auth.backends.ModelBackend',
] ]
SOCIAL_AUTH_PIPELINE = (
'social_core.pipeline.social_auth.social_details',
'social_core.pipeline.social_auth.social_uid',
'social_core.pipeline.social_auth.auth_allowed',
'social_core.pipeline.social_auth.social_user',
'social_core.pipeline.user.get_username',
'social_core.pipeline.user.create_user',
'account.auth_pipeline.create_profile',
'social_core.pipeline.social_auth.associate_user',
'social_core.pipeline.social_auth.load_extra_data',
'social_core.pipeline.user.user_details',
)
SOCIAL_AUTH_AUTHSCH_KEY = os.getenv('AUTHSCH_KEY') SOCIAL_AUTH_AUTHSCH_KEY = os.getenv('AUTHSCH_KEY')
SOCIAL_AUTH_AUTHSCH_SECRET = os.getenv('AUTHSCH_SECRET') SOCIAL_AUTH_AUTHSCH_SECRET = os.getenv('AUTHSCH_SECRET')
SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/' SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment