I am creating a partial pipeline to get user's phone number on signup and skip the step on subsequent logins. My partial pipeline looks like this:
@partial
def other_info(strategy, details, user=None, is_new=False, *args, **kwargs):
if is_new or not details.get('email'):
request = kwargs['request']
return redirect('require_phone')
else:
return
On the page-welcome.html
there is a form. Corresponding view looks like this:
def require_phone(request):
if request.method == 'POST':
phone = request.POST.get('phone',None)
user = User.objects.get(username = request.user.username)
if phone is not None:
up = UserProfile.objects.get_or_create(user=request.user,
phone = phone)
up.save()
backend = request.session['partial_pipeline']['backend']
return redirect('social:complete', backend=backend)
else:
return render(request,'app/page-welcome.html')
The problem is, the request object is not passed correctly to the view and hence the user shows anonymous. I am not able to access user object and hence cannot save phone no.