1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2024-12-25 17:42:24 +00:00

🙈 Don't send any password to admins while registering

This commit is contained in:
Yohann D'ANELLO 2020-07-13 20:29:05 +02:00
parent dd62a32e08
commit c30a0cdf86

View File

@ -8,8 +8,10 @@ from django.http import FileResponse, Http404
from django.shortcuts import redirect from django.shortcuts import redirect
from django.urls import reverse_lazy from django.urls import reverse_lazy
from django.utils import timezone from django.utils import timezone
from django.utils.decorators import method_decorator
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django.views import View from django.views import View
from django.views.decorators.debug import sensitive_post_parameters
from django.views.generic import CreateView, UpdateView, DetailView, FormView from django.views.generic import CreateView, UpdateView, DetailView, FormView
from django_tables2 import SingleTableView from django_tables2 import SingleTableView
from tournament.forms import TeamForm, JoinTeam from tournament.forms import TeamForm, JoinTeam
@ -29,6 +31,14 @@ class CreateUserView(CreateView):
form_class = SignUpForm form_class = SignUpForm
template_name = "registration/signup.html" template_name = "registration/signup.html"
# When errors are reported from the signup view, don't send passwords to admins
@method_decorator(sensitive_post_parameters('password1', 'password2',))
def dispatch(self, request, *args, **kwargs):
return super().dispatch(request, *args, **kwargs)
def get_success_url(self):
return reverse_lazy('index')
class MyAccountView(LoginRequiredMixin, UpdateView): class MyAccountView(LoginRequiredMixin, UpdateView):
""" """