I am trying to create a minimal working example in which I am breaking Python Social Auth pipeline, ask for new password from the user and return back.
Here is the custom pipeline function:
@partial
def get_password(strategy, backend, request, user = None, is_new = False, *args, **kwargs):
if user:
if is_new:
if not request.get('password', None):
return redirect("accounts:get_password")
user = User.objects.get(email=kwargs['email'])
user.set_password(request['password'])
user.save()
return
Here is the view:
def get_password(request, template_name='accounts/password_change_form.html',extra_context=None):
if not extra_context: extra_context = dict()
if request.method == 'POST':
form = PasswordForm(request.POST)
if form.is_valid():
request.session['password'] = form.cleaned_data['password1']
backend = request.session['partial_pipeline']['backend']
return redirect('social:complete', backend=backend)
else:
form = PasswordForm()
extra_context["form"] = form
return ExtraContextTemplateView.as_view(template_name=template_name,
extra_context=extra_context)(request)
Here is line from settings related to 'password' field:
Everything seems to be according to the examples described in PSA docs. The only one difference - it is not working and password saved in session not returned to the pipeline. Please, help, if you have any ideas how to repair it.
I am trying to create a minimal working example in which I am breaking Python Social Auth pipeline, ask for new password from the user and return back.
Here is the custom pipeline function:
Here is the view:
Here is line from settings related to 'password' field:
SOCIAL_AUTH_FIELDS_STORED_IN_SESSION = ['password',]
Everything seems to be according to the examples described in PSA docs. The only one difference - it is not working and password saved in session not returned to the pipeline. Please, help, if you have any ideas how to repair it.