8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-23 07:23:46 +00:00

Authenticate automatically the user after signup

This commit is contained in:
Yohann D'ANELLO 2021-02-01 19:24:03 +01:00
parent 8008aeaf56
commit c35c0feccf
No known key found for this signature in database
GPG key ID: 3A75C55819C8CF85

View file

@ -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)