1๐
You should put your pipeline entry after the user is created and the social account is associated (after social_auth.backends.pipeline.social.associate_user
entry), then you can try with this code:
def gather_extra_data(social_auth, user, details, request, is_new=False, *args, **kwargs):
if is_new:
if request.session.get('saved_email') is None:
return redirect(request_extra, backend=backend.name)
else:
details['email'] = request.session['saved_email']
details['password'] = request.session['password']
details['first_name'] = request.session['first_name']
details['last_name'] = request.session['last_name']
details['dob'] = request.session['dob']
details['gender'] = request.session['gender']
details['avatar_url'] = request.session['avatar_url']
Remember to put social_auth.backends.pipeline.misc.save_status_to_session
before your entry.
๐คomab
0๐
Try this way:
def gather_extra_data(backend, details, uid, request, user=None, is_new=False, *args, **kwargs):
If not user is None and is_new: #is_new is your missing argument.
if not details.get('email'):
if not request.session.get('saved_email'):
return redirect(request_extra, backend=backend.name)
else:
details['email'] = request.session['saved_email']
details['password'] = request.session['password']
details['first_name'] = request.session['first_name']
details['last_name'] = request.session['last_name']
details['dob'] = request.session['dob']
details['gender'] = request.session['gender']
details['avatar_url'] = request.session['avatar_url']
๐คPiotr Kowalczuk
- [Answer]-Django sendfile download โ Page not found
- [Answer]-Have custom manager but keep objects keyword available
- [Answer]-How detect role user in django template?
- [Answer]-Django โ separate apps on different uwsgi instances โ share code between them
- [Answer]-Hg mercurial โ how to merge in 3 way merge window in shell
Source:stackexchange.com