8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-30 08:32:26 +00:00

Improve template for resending a confirmation email

This commit is contained in:
Jean-Romain Garnier 2020-04-17 11:22:29 +02:00 committed by Gabriel Detraz
parent 0ac4d81177
commit b190549618
4 changed files with 58 additions and 22 deletions

View file

@ -299,11 +299,6 @@ class ResetPasswordForm(forms.Form):
email = forms.EmailField(max_length=255) email = forms.EmailField(max_length=255)
class ResendConfirmationEmailForm(forms.Form):
"""Formulaire de renvoie du mail de confirmation"""
pass
class MassArchiveForm(forms.Form): class MassArchiveForm(forms.Form):
"""Formulaire d'archivage des users inactif. Prend en argument """Formulaire d'archivage des users inactif. Prend en argument
du formulaire la date de depart avant laquelle archiver les du formulaire la date de depart avant laquelle archiver les

View file

@ -339,7 +339,7 @@ class User(
def set_active(self): def set_active(self):
"""Enable this user if he subscribed successfully one time before """Enable this user if he subscribed successfully one time before
Reenable it if it was archived Reenable it if it was archived
Do nothing if disabed""" Do nothing if disabled or waiting for email confirmation"""
if self.state == self.STATE_NOT_YET_ACTIVE: if self.state == self.STATE_NOT_YET_ACTIVE:
if self.facture_set.filter(valid=True).filter( if self.facture_set.filter(valid=True).filter(
Q(vente__type_cotisation="All") | Q(vente__type_cotisation="Adhesion") Q(vente__type_cotisation="All") | Q(vente__type_cotisation="Adhesion")

View file

@ -0,0 +1,44 @@
{% extends 'users/sidebar.html' %}
{% comment %}
Re2o est un logiciel d'administration développé initiallement au rezometz. Il
se veut agnostique au réseau considéré, de manière à être installable en
quelques clics.
Copyright © 2017 Gabriel Détraz
Copyright © 2017 Lara Kermarec
Copyright © 2017 Augustin Lemesle
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %}
{% load bootstrap3 %}
{% load i18n %}
{% block title %}{% trans "Confirmation email" %}{% endblock %}
{% block content %}
<form class="form" method="post">
{% csrf_token %}
<h4>{% blocktrans %}Re-send confirmation email{% endblocktrans %}</h4>
<p>{% blocktrans %}The confirmation email will be sent to {{ email }}.{% endblocktrans %}</p>
{% trans "Confirm" as tr_confirm %}
{% bootstrap_button tr_confirm button_type="submit" icon="ok" button_class="btn-success" %}
</form>
<br />
<br />
<br />
{% endblock %}

View file

@ -107,7 +107,6 @@ from .forms import (
PassForm, PassForm,
ConfirmMailForm, ConfirmMailForm,
ResetPasswordForm, ResetPasswordForm,
ResendConfirmationEmailForm,
ClubAdminandMembersForm, ClubAdminandMembersForm,
GroupForm, GroupForm,
InitialRegisterForm, InitialRegisterForm,
@ -228,7 +227,7 @@ def edit_info(request, user, userid):
if user_form.should_send_confirmation_email: if user_form.should_send_confirmation_email:
user.confirm_email_address_mail(request) user.confirm_email_address_mail(request)
messages.warning(request, _("Sent a new confirmation email")) messages.success(request, _("Sent a new confirmation email"))
return redirect(reverse("users:profil", kwargs={"userid": str(userid)})) return redirect(reverse("users:profil", kwargs={"userid": str(userid)}))
return form( return form(
@ -1034,8 +1033,6 @@ def process_passwd(request, req):
def resend_confirmation_email(request, userid): def resend_confirmation_email(request, userid):
""" Renvoie du mail de confirmation """ """ Renvoie du mail de confirmation """
userform = ResendConfirmationEmailForm(request.POST or None)
if userform.is_valid():
try: try:
user = User.objects.get( user = User.objects.get(
id=userid, id=userid,
@ -1043,17 +1040,17 @@ def resend_confirmation_email(request, userid):
) )
except User.DoesNotExist: except User.DoesNotExist:
messages.error(request, _("The user doesn't exist.")) messages.error(request, _("The user doesn't exist."))
return form( return redirect(reverse("users:profil", kwargs={"userid": userid}))
{"userform": userform, "action_name": _("Reset")},
"users/user.html", if userform.is_valid():
request,
)
user.confirm_email_address_mail(request) user.confirm_email_address_mail(request)
messages.success(request, _("An email to confirm your address was sent.")) messages.success(request, _("An email to confirm your address was sent."))
return redirect(reverse("users:profil", kwargs={"userid": userid})) return redirect(reverse("users:profil", kwargs={"userid": userid}))
return form( return form(
{"userform": userform, "action_name": _("Send")}, "users/user.html", request {"email": user.email},
"users/resend_confirmation_email.html",
request,
) )