django - SOCIAL_AUTH_FIELDS_STORED_IN_SESSION in python-social-auth is always None in my custom pipeline -
i'm trying session social variable template. have 2 separate buttons signup , login using key login_type:
<a href="{% url 'social:begin' 'facebook' %}?next={{ request.path }}?login_type=1"><img src='img.png'> </a> <a href="{% url 'social:begin' 'facebook' %}?next={{ request.path }}?login_type=2"><img src='img2.png'></a>
in settings:
social_auth_fields_stored_in_session = ['login_type']
i tried with:
fields_stored_in_session = ['login_type']
my custom pipeline:
social_auth_pipeline = ( 'social.pipeline.social_auth.social_details', 'social.pipeline.social_auth.social_uid', 'social.pipeline.social_auth.auth_allowed', 'social.pipeline.social_auth.social_user', 'fbauth.facebook.check_if_exists', 'social.pipeline.user.get_username', 'social.pipeline.user.create_user', 'social.pipeline.social_auth.associate_user', 'social.pipeline.social_auth.load_extra_data', 'social.pipeline.user.user_details', )
facebook.py:
from django.conf import settings django.shortcuts import redirect, httpresponse def check_if_exists(strategy, request, *args, **kwargs): login_type = strategy.request.get.get('login_type') #login_type = strategy.session_get('key') (i tried cases) #login_type = request['login_type'] #login_type = strategy.request['login_type'] logger.debug("is_new parameter %s", kwargs['is_new']) logger.debug("login_type %s", login_type) if kwargs['is_new']: if login_type == 1: return redirect('/', message ='specified social account not yet associate existent user, try sign first') else: if login_type == 2: return redirect('/', message = 'user account exist, try login') return none
but, in cases in logs see "login_type none"
what's wrong?
it seems form params wrong. should change
<code><pre>?next={{ request.path }}?login_type=1</pre></code>
to
<code><pre>?next={{ request.path }}&login_type=1</pre></code>
Comments
Post a Comment