mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 11:23:10 +00:00
Improve template for resending a confirmation email
This commit is contained in:
parent
f171eeb607
commit
c76d5c7102
4 changed files with 58 additions and 22 deletions
|
@ -299,11 +299,6 @@ class ResetPasswordForm(forms.Form):
|
|||
email = forms.EmailField(max_length=255)
|
||||
|
||||
|
||||
class ResendConfirmationEmailForm(forms.Form):
|
||||
"""Formulaire de renvoie du mail de confirmation"""
|
||||
pass
|
||||
|
||||
|
||||
class MassArchiveForm(forms.Form):
|
||||
"""Formulaire d'archivage des users inactif. Prend en argument
|
||||
du formulaire la date de depart avant laquelle archiver les
|
||||
|
|
|
@ -339,7 +339,7 @@ class User(
|
|||
def set_active(self):
|
||||
"""Enable this user if he subscribed successfully one time before
|
||||
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.facture_set.filter(valid=True).filter(
|
||||
Q(vente__type_cotisation="All") | Q(vente__type_cotisation="Adhesion")
|
||||
|
|
44
users/templates/users/resend_confirmation_email.html
Normal file
44
users/templates/users/resend_confirmation_email.html
Normal 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 %}
|
||||
|
|
@ -107,7 +107,6 @@ from .forms import (
|
|||
PassForm,
|
||||
ConfirmMailForm,
|
||||
ResetPasswordForm,
|
||||
ResendConfirmationEmailForm,
|
||||
ClubAdminandMembersForm,
|
||||
GroupForm,
|
||||
InitialRegisterForm,
|
||||
|
@ -228,7 +227,7 @@ def edit_info(request, user, userid):
|
|||
|
||||
if user_form.should_send_confirmation_email:
|
||||
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 form(
|
||||
|
@ -1034,26 +1033,24 @@ def process_passwd(request, req):
|
|||
|
||||
def resend_confirmation_email(request, userid):
|
||||
""" Renvoie du mail de confirmation """
|
||||
userform = ResendConfirmationEmailForm(request.POST or None)
|
||||
try:
|
||||
user = User.objects.get(
|
||||
id=userid,
|
||||
state__in=[User.STATE_EMAIL_NOT_YET_CONFIRMED],
|
||||
)
|
||||
except User.DoesNotExist:
|
||||
messages.error(request, _("The user doesn't exist."))
|
||||
return redirect(reverse("users:profil", kwargs={"userid": userid}))
|
||||
|
||||
if userform.is_valid():
|
||||
try:
|
||||
user = User.objects.get(
|
||||
id=userid,
|
||||
state__in=[User.STATE_EMAIL_NOT_YET_CONFIRMED],
|
||||
)
|
||||
except User.DoesNotExist:
|
||||
messages.error(request, _("The user doesn't exist."))
|
||||
return form(
|
||||
{"userform": userform, "action_name": _("Reset")},
|
||||
"users/user.html",
|
||||
request,
|
||||
)
|
||||
user.confirm_email_address_mail(request)
|
||||
messages.success(request, _("An email to confirm your address was sent."))
|
||||
return redirect(reverse("users:profil", kwargs={"userid": userid}))
|
||||
|
||||
return form(
|
||||
{"userform": userform, "action_name": _("Send")}, "users/user.html", request
|
||||
{"email": user.email},
|
||||
"users/resend_confirmation_email.html",
|
||||
request,
|
||||
)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue