From c35c0feccf7bdf3ed748437f660b312bacaa0ac7 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Mon, 1 Feb 2021 19:24:03 +0100 Subject: [PATCH] Authenticate automatically the user after signup --- portail/views.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/portail/views.py b/portail/views.py index 07d81fcf..d2c7e304 100644 --- a/portail/views.py +++ b/portail/views.py @@ -33,7 +33,7 @@ accessing to the full Re2o. from cotisations.models import Facture, Vente from cotisations.utils import find_payment_method -from django.contrib.auth import login +from django.contrib.auth import authenticate, login from django.db import transaction from django.urls import reverse_lazy from django.views.generic import CreateView, TemplateView @@ -68,7 +68,6 @@ class SignUpView(CreateView): # Login automatically into the new account user = form.instance - login(self.request, form.instance) # Buy the new membership payment_method = membership_form.cleaned_data["payment_method"] @@ -99,6 +98,9 @@ class SignUpView(CreateView): super().form_valid(form) + user = authenticate(username=user.pseudo, password=form.cleaned_data["password1"]) + login(self.request, user) + # POOP CODE, pliz Re2o # End the payment process, it mays redirect to ComNPay return payment_method.end_payment(invoice, self.request)