Compare commits

..

2 Commits

Author SHA1 Message Date
Yohann D'ANELLO 82aa0182e3 🐛 Hide "I am the emitter" button on credit and debit interfaces 2020-08-01 10:58:21 +02:00
Yohann D'ANELLO 23b775447c 🐛 Fix email validation link 2020-08-01 10:48:17 +02:00
8 changed files with 92 additions and 77 deletions

View File

@ -131,7 +131,7 @@ class Profile(models.Model):
return reverse('user_detail', args=(self.pk,)) return reverse('user_detail', args=(self.pk,))
def send_email_validation_link(self): def send_email_validation_link(self):
subject = "Activate your Note Kfet account" subject = _("Activate your Note Kfet account")
message = loader.render_to_string('registration/mails/email_validation_email.html', message = loader.render_to_string('registration/mails/email_validation_email.html',
{ {
'user': self.user, 'user': self.user,

View File

@ -108,6 +108,7 @@ class UserUpdateView(ProtectQuerysetMixin, LoginRequiredMixin, UpdateView):
if olduser.email != user.email: if olduser.email != user.email:
# If the user changed her/his email, then it is unvalidated and a confirmation link is sent. # If the user changed her/his email, then it is unvalidated and a confirmation link is sent.
user.profile.email_confirmed = False user.profile.email_confirmed = False
user.profile.save()
user.profile.send_email_validation_link() user.profile.send_email_validation_link()
return super().form_valid(form) return super().form_valid(form)

View File

@ -24,7 +24,8 @@ class AccountActivationTokenGenerator(PasswordResetTokenGenerator):
# Truncate microseconds so that tokens are consistent even if the # Truncate microseconds so that tokens are consistent even if the
# database doesn't support microseconds. # database doesn't support microseconds.
login_timestamp = '' if user.last_login is None else user.last_login.replace(microsecond=0, tzinfo=None) login_timestamp = '' if user.last_login is None else user.last_login.replace(microsecond=0, tzinfo=None)
return str(user.pk) + str(user.profile.email_confirmed) + str(login_timestamp) + str(timestamp) return str(user.pk) + str(user.email) + str(user.profile.email_confirmed)\
+ str(login_timestamp) + str(timestamp)
email_validation_token = AccountActivationTokenGenerator() email_validation_token = AccountActivationTokenGenerator()

View File

@ -79,7 +79,7 @@ class UserValidateView(TemplateView):
""" """
title = _("Email validation") title = _("Email validation")
template_name = 'registration/email_validation_complete.html' template_name = 'registration/email_validation_complete.html'
extra_context = {"title": _("Validate a registration")} extra_context = {"title": _("Validate email")}
def get(self, *args, **kwargs): def get(self, *args, **kwargs):
""" """
@ -93,16 +93,13 @@ class UserValidateView(TemplateView):
# Validate the token # Validate the token
if user is not None and email_validation_token.check_token(user, token): if user is not None and email_validation_token.check_token(user, token):
self.validlink = True
# The user must wait that someone validates the account before the user can be active and login. # The user must wait that someone validates the account before the user can be active and login.
self.validlink = True
user.is_active = user.profile.registration_valid or user.is_superuser user.is_active = user.profile.registration_valid or user.is_superuser
user.profile.email_confirmed = True user.profile.email_confirmed = True
user.save() user.save()
user.profile.save() user.profile.save()
return super().dispatch(*args, **kwargs) return self.render_to_response(self.get_context_data())
else:
# Display the "Email validation unsuccessful" page.
return self.render_to_response(self.get_context_data())
def get_user(self, uidb64): def get_user(self, uidb64):
""" """

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-07-31 22:25+0200\n" "POT-Creation-Date: 2020-08-01 10:47+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -456,6 +456,10 @@ msgstr ""
msgid "user profile" msgid "user profile"
msgstr "" msgstr ""
#: apps/member/models.py:134
msgid "Activate your Note Kfet account"
msgstr ""
#: apps/member/models.py:156 templates/member/club_info.html:57 #: apps/member/models.py:156 templates/member/club_info.html:57
#: templates/registration/future_profile_detail.html:22 #: templates/registration/future_profile_detail.html:22
#: templates/wei/weiclub_info.html:52 templates/wei/weimembership_form.html:24 #: templates/wei/weiclub_info.html:52 templates/wei/weimembership_form.html:24
@ -533,7 +537,7 @@ msgstr ""
msgid "fee" msgid "fee"
msgstr "" msgstr ""
#: apps/member/models.py:303 apps/member/views.py:534 apps/wei/views.py:797 #: apps/member/models.py:303 apps/member/views.py:535 apps/wei/views.py:797
msgid "User is not a member of the parent club" msgid "User is not a member of the parent club"
msgstr "" msgstr ""
@ -542,7 +546,7 @@ msgstr ""
msgid "The role {role} does not apply to the club {club}." msgid "The role {role} does not apply to the club {club}."
msgstr "" msgstr ""
#: apps/member/models.py:321 apps/member/views.py:543 #: apps/member/models.py:321 apps/member/views.py:544
msgid "User is already a member of the club" msgid "User is already a member of the club"
msgstr "" msgstr ""
@ -573,71 +577,71 @@ msgstr ""
msgid "This address must be valid." msgid "This address must be valid."
msgstr "" msgstr ""
#: apps/member/views.py:127 #: apps/member/views.py:128
msgid "Profile detail" msgid "Profile detail"
msgstr "" msgstr ""
#: apps/member/views.py:161 #: apps/member/views.py:162
msgid "Search user" msgid "Search user"
msgstr "" msgstr ""
#: apps/member/views.py:195 apps/member/views.py:381 #: apps/member/views.py:196 apps/member/views.py:382
msgid "Note aliases" msgid "Note aliases"
msgstr "" msgstr ""
#: apps/member/views.py:209 #: apps/member/views.py:210
msgid "Update note picture" msgid "Update note picture"
msgstr "" msgstr ""
#: apps/member/views.py:267 templates/member/profile_info.html:43 #: apps/member/views.py:268 templates/member/profile_info.html:43
msgid "Manage auth token" msgid "Manage auth token"
msgstr "" msgstr ""
#: apps/member/views.py:295 #: apps/member/views.py:296
msgid "Create new club" msgid "Create new club"
msgstr "" msgstr ""
#: apps/member/views.py:307 #: apps/member/views.py:308
msgid "Search club" msgid "Search club"
msgstr "" msgstr ""
#: apps/member/views.py:332 #: apps/member/views.py:333
msgid "Club detail" msgid "Club detail"
msgstr "" msgstr ""
#: apps/member/views.py:398 #: apps/member/views.py:399
msgid "Update club" msgid "Update club"
msgstr "" msgstr ""
#: apps/member/views.py:432 #: apps/member/views.py:433
msgid "Add new member to the club" msgid "Add new member to the club"
msgstr "" msgstr ""
#: apps/member/views.py:529 apps/wei/views.py:788 #: apps/member/views.py:530 apps/wei/views.py:788
msgid "" msgid ""
"This user don't have enough money to join this club, and can't have a " "This user don't have enough money to join this club, and can't have a "
"negative balance." "negative balance."
msgstr "" msgstr ""
#: apps/member/views.py:547 #: apps/member/views.py:548
msgid "The membership must start after {:%m-%d-%Y}." msgid "The membership must start after {:%m-%d-%Y}."
msgstr "" msgstr ""
#: apps/member/views.py:552 #: apps/member/views.py:553
msgid "The membership must begin before {:%m-%d-%Y}." msgid "The membership must begin before {:%m-%d-%Y}."
msgstr "" msgstr ""
#: apps/member/views.py:569 apps/member/views.py:571 apps/member/views.py:573 #: apps/member/views.py:570 apps/member/views.py:572 apps/member/views.py:574
#: apps/registration/views.py:295 apps/registration/views.py:297 #: apps/registration/views.py:292 apps/registration/views.py:294
#: apps/registration/views.py:299 #: apps/registration/views.py:296
msgid "This field is required." msgid "This field is required."
msgstr "" msgstr ""
#: apps/member/views.py:641 #: apps/member/views.py:642
msgid "Manage roles of an user in the club" msgid "Manage roles of an user in the club"
msgstr "" msgstr ""
#: apps/member/views.py:666 #: apps/member/views.py:667
msgid "Members of the club" msgid "Members of the club"
msgstr "" msgstr ""
@ -1051,47 +1055,47 @@ msgid "Email validation"
msgstr "" msgstr ""
#: apps/registration/views.py:82 #: apps/registration/views.py:82
msgid "Validate a registration" msgid "Validate email"
msgstr "" msgstr ""
#: apps/registration/views.py:127 #: apps/registration/views.py:124
msgid "Email validation unsuccessful" msgid "Email validation unsuccessful"
msgstr "" msgstr ""
#: apps/registration/views.py:138 #: apps/registration/views.py:135
msgid "Email validation email sent" msgid "Email validation email sent"
msgstr "" msgstr ""
#: apps/registration/views.py:146 #: apps/registration/views.py:143
msgid "Resend email validation link" msgid "Resend email validation link"
msgstr "" msgstr ""
#: apps/registration/views.py:164 #: apps/registration/views.py:161
msgid "Pre-registered users list" msgid "Pre-registered users list"
msgstr "" msgstr ""
#: apps/registration/views.py:193 #: apps/registration/views.py:190
msgid "Unregistered users" msgid "Unregistered users"
msgstr "" msgstr ""
#: apps/registration/views.py:206 #: apps/registration/views.py:203
msgid "Registration detail" msgid "Registration detail"
msgstr "" msgstr ""
#: apps/registration/views.py:261 #: apps/registration/views.py:258
msgid "You must join the BDE." msgid "You must join the BDE."
msgstr "" msgstr ""
#: apps/registration/views.py:283 #: apps/registration/views.py:280
msgid "You must join BDE club before joining Kfet club." msgid "You must join BDE club before joining Kfet club."
msgstr "" msgstr ""
#: apps/registration/views.py:288 #: apps/registration/views.py:285
msgid "" msgid ""
"The entered amount is not enough for the memberships, should be at least {}" "The entered amount is not enough for the memberships, should be at least {}"
msgstr "" msgstr ""
#: apps/registration/views.py:363 #: apps/registration/views.py:360
msgid "Invalidate pre-registration" msgid "Invalidate pre-registration"
msgstr "" msgstr ""

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-07-31 22:25+0200\n" "POT-Creation-Date: 2020-08-01 10:47+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -457,6 +457,10 @@ msgstr "inscription valid"
msgid "user profile" msgid "user profile"
msgstr "profil utilisateur" msgstr "profil utilisateur"
#: apps/member/models.py:134
msgid "Activate your Note Kfet account"
msgstr "Activez votre compte Note Kfet"
#: apps/member/models.py:156 templates/member/club_info.html:57 #: apps/member/models.py:156 templates/member/club_info.html:57
#: templates/registration/future_profile_detail.html:22 #: templates/registration/future_profile_detail.html:22
#: templates/wei/weiclub_info.html:52 templates/wei/weimembership_form.html:24 #: templates/wei/weiclub_info.html:52 templates/wei/weimembership_form.html:24
@ -538,7 +542,7 @@ msgstr "l'adhésion finit le"
msgid "fee" msgid "fee"
msgstr "cotisation" msgstr "cotisation"
#: apps/member/models.py:303 apps/member/views.py:534 apps/wei/views.py:797 #: apps/member/models.py:303 apps/member/views.py:535 apps/wei/views.py:797
msgid "User is not a member of the parent club" msgid "User is not a member of the parent club"
msgstr "L'utilisateur n'est pas membre du club parent" msgstr "L'utilisateur n'est pas membre du club parent"
@ -547,7 +551,7 @@ msgstr "L'utilisateur n'est pas membre du club parent"
msgid "The role {role} does not apply to the club {club}." msgid "The role {role} does not apply to the club {club}."
msgstr "Le rôle {role} ne s'applique pas au club {club}." msgstr "Le rôle {role} ne s'applique pas au club {club}."
#: apps/member/models.py:321 apps/member/views.py:543 #: apps/member/models.py:321 apps/member/views.py:544
msgid "User is already a member of the club" msgid "User is already a member of the club"
msgstr "L'utilisateur est déjà membre du club" msgstr "L'utilisateur est déjà membre du club"
@ -578,47 +582,47 @@ msgstr "Modifier le profil"
msgid "This address must be valid." msgid "This address must be valid."
msgstr "Cette adresse doit être valide." msgstr "Cette adresse doit être valide."
#: apps/member/views.py:127 #: apps/member/views.py:128
msgid "Profile detail" msgid "Profile detail"
msgstr "Détails de l'utilisateur" msgstr "Détails de l'utilisateur"
#: apps/member/views.py:161 #: apps/member/views.py:162
msgid "Search user" msgid "Search user"
msgstr "Chercher un utilisateur" msgstr "Chercher un utilisateur"
#: apps/member/views.py:195 apps/member/views.py:381 #: apps/member/views.py:196 apps/member/views.py:382
msgid "Note aliases" msgid "Note aliases"
msgstr "Alias de la note" msgstr "Alias de la note"
#: apps/member/views.py:209 #: apps/member/views.py:210
msgid "Update note picture" msgid "Update note picture"
msgstr "Modifier la photo de la note" msgstr "Modifier la photo de la note"
#: apps/member/views.py:267 templates/member/profile_info.html:43 #: apps/member/views.py:268 templates/member/profile_info.html:43
msgid "Manage auth token" msgid "Manage auth token"
msgstr "Gérer les jetons d'authentification" msgstr "Gérer les jetons d'authentification"
#: apps/member/views.py:295 #: apps/member/views.py:296
msgid "Create new club" msgid "Create new club"
msgstr "Créer un nouveau club" msgstr "Créer un nouveau club"
#: apps/member/views.py:307 #: apps/member/views.py:308
msgid "Search club" msgid "Search club"
msgstr "Chercher un club" msgstr "Chercher un club"
#: apps/member/views.py:332 #: apps/member/views.py:333
msgid "Club detail" msgid "Club detail"
msgstr "Détails du club" msgstr "Détails du club"
#: apps/member/views.py:398 #: apps/member/views.py:399
msgid "Update club" msgid "Update club"
msgstr "Modifier le club" msgstr "Modifier le club"
#: apps/member/views.py:432 #: apps/member/views.py:433
msgid "Add new member to the club" msgid "Add new member to the club"
msgstr "Ajouter un nouveau membre au club" msgstr "Ajouter un nouveau membre au club"
#: apps/member/views.py:529 apps/wei/views.py:788 #: apps/member/views.py:530 apps/wei/views.py:788
msgid "" msgid ""
"This user don't have enough money to join this club, and can't have a " "This user don't have enough money to join this club, and can't have a "
"negative balance." "negative balance."
@ -626,25 +630,25 @@ msgstr ""
"Cet utilisateur n'a pas assez d'argent pour rejoindre ce club et ne peut pas " "Cet utilisateur n'a pas assez d'argent pour rejoindre ce club et ne peut pas "
"avoir un solde négatif." "avoir un solde négatif."
#: apps/member/views.py:547 #: apps/member/views.py:548
msgid "The membership must start after {:%m-%d-%Y}." msgid "The membership must start after {:%m-%d-%Y}."
msgstr "L'adhésion doit commencer après le {:%d/%m/%Y}." msgstr "L'adhésion doit commencer après le {:%d/%m/%Y}."
#: apps/member/views.py:552 #: apps/member/views.py:553
msgid "The membership must begin before {:%m-%d-%Y}." msgid "The membership must begin before {:%m-%d-%Y}."
msgstr "L'adhésion doit commencer avant le {:%d/%m/%Y}." msgstr "L'adhésion doit commencer avant le {:%d/%m/%Y}."
#: apps/member/views.py:569 apps/member/views.py:571 apps/member/views.py:573 #: apps/member/views.py:570 apps/member/views.py:572 apps/member/views.py:574
#: apps/registration/views.py:295 apps/registration/views.py:297 #: apps/registration/views.py:292 apps/registration/views.py:294
#: apps/registration/views.py:299 #: apps/registration/views.py:296
msgid "This field is required." msgid "This field is required."
msgstr "Ce champ est requis." msgstr "Ce champ est requis."
#: apps/member/views.py:641 #: apps/member/views.py:642
msgid "Manage roles of an user in the club" msgid "Manage roles of an user in the club"
msgstr "Gérer les rôles d'un utilisateur dans le club" msgstr "Gérer les rôles d'un utilisateur dans le club"
#: apps/member/views.py:666 #: apps/member/views.py:667
msgid "Members of the club" msgid "Members of the club"
msgstr "Membres du club" msgstr "Membres du club"
@ -1076,49 +1080,49 @@ msgid "Email validation"
msgstr "Validation de l'adresse mail" msgstr "Validation de l'adresse mail"
#: apps/registration/views.py:82 #: apps/registration/views.py:82
msgid "Validate a registration" msgid "Validate email"
msgstr "Valider l'inscription" msgstr "Valider l'adresse e-mail"
#: apps/registration/views.py:127 #: apps/registration/views.py:124
msgid "Email validation unsuccessful" msgid "Email validation unsuccessful"
msgstr " La validation de l'adresse mail a échoué" msgstr " La validation de l'adresse mail a échoué"
#: apps/registration/views.py:138 #: apps/registration/views.py:135
msgid "Email validation email sent" msgid "Email validation email sent"
msgstr "L'email de vérification de l'adresse email a bien été envoyé." msgstr "L'email de vérification de l'adresse email a bien été envoyé."
#: apps/registration/views.py:146 #: apps/registration/views.py:143
msgid "Resend email validation link" msgid "Resend email validation link"
msgstr "Renvoyer le lien de validation" msgstr "Renvoyer le lien de validation"
#: apps/registration/views.py:164 #: apps/registration/views.py:161
msgid "Pre-registered users list" msgid "Pre-registered users list"
msgstr "Liste des utilisateurs en attente d'inscription" msgstr "Liste des utilisateurs en attente d'inscription"
#: apps/registration/views.py:193 #: apps/registration/views.py:190
msgid "Unregistered users" msgid "Unregistered users"
msgstr "Utilisateurs en attente d'inscription" msgstr "Utilisateurs en attente d'inscription"
#: apps/registration/views.py:206 #: apps/registration/views.py:203
msgid "Registration detail" msgid "Registration detail"
msgstr "Détails de l'inscription" msgstr "Détails de l'inscription"
#: apps/registration/views.py:261 #: apps/registration/views.py:258
msgid "You must join the BDE." msgid "You must join the BDE."
msgstr "Vous devez adhérer au BDE." msgstr "Vous devez adhérer au BDE."
#: apps/registration/views.py:283 #: apps/registration/views.py:280
msgid "You must join BDE club before joining Kfet club." msgid "You must join BDE club before joining Kfet club."
msgstr "Vous devez adhérer au club BDE avant d'adhérer au club Kfet." msgstr "Vous devez adhérer au club BDE avant d'adhérer au club Kfet."
#: apps/registration/views.py:288 #: apps/registration/views.py:285
msgid "" msgid ""
"The entered amount is not enough for the memberships, should be at least {}" "The entered amount is not enough for the memberships, should be at least {}"
msgstr "" msgstr ""
"Le montant crédité est trop faible pour adhérer, il doit être au minimum de " "Le montant crédité est trop faible pour adhérer, il doit être au minimum de "
"{}" "{}"
#: apps/registration/views.py:363 #: apps/registration/views.py:360
msgid "Invalidate pre-registration" msgid "Invalidate pre-registration"
msgstr "Invalider l'inscription" msgstr "Invalider l'inscription"
@ -2660,3 +2664,6 @@ msgstr "Il n'y a pas de pré-inscription en attente avec cette entrée."
#: templates/wei/weiregistration_list.html:24 #: templates/wei/weiregistration_list.html:24
msgid "View validated memberships..." msgid "View validated memberships..."
msgstr "Voir les adhésions validées ..." msgstr "Voir les adhésions validées ..."
#~ msgid "Validate a registration"
#~ msgstr "Valider l'inscription"

View File

@ -80,6 +80,7 @@ $(document).ready(function() {
let dest = $("#dest_note"); let dest = $("#dest_note");
$("#type_transfer").click(function() { $("#type_transfer").click(function() {
$("#source_me_div").removeClass('d-none');
$("#special_transaction_div").addClass('d-none'); $("#special_transaction_div").addClass('d-none');
source.attr('disabled', false); source.attr('disabled', false);
$("#source_note_list").removeClass('d-none'); $("#source_note_list").removeClass('d-none');
@ -88,6 +89,7 @@ $(document).ready(function() {
}); });
$("#type_credit").click(function() { $("#type_credit").click(function() {
$("#source_me_div").addClass('d-none');
$("#special_transaction_div").removeClass('d-none'); $("#special_transaction_div").removeClass('d-none');
$("#source_note_list").addClass('d-none'); $("#source_note_list").addClass('d-none');
$("#dest_note_list").removeClass('d-none'); $("#dest_note_list").removeClass('d-none');
@ -105,6 +107,7 @@ $(document).ready(function() {
}); });
$("#type_debit").click(function() { $("#type_debit").click(function() {
$("#source_me_div").addClass('d-none');
$("#special_transaction_div").removeClass('d-none'); $("#special_transaction_div").removeClass('d-none');
$("#source_note_list").removeClass('d-none'); $("#source_note_list").removeClass('d-none');
$("#dest_note_list").addClass('d-none'); $("#dest_note_list").addClass('d-none');

View File

@ -55,10 +55,12 @@ SPDX-License-Identifier: GPL-2.0-or-later
</ul> </ul>
<div class="card-body"> <div class="card-body">
<input class="form-control mx-auto d-block" type="text" id="source_note" placeholder="{% trans "Name or alias..." %}" /> <input class="form-control mx-auto d-block" type="text" id="source_note" placeholder="{% trans "Name or alias..." %}" />
<hr> <div id="source_me_div">
<span class="form-control mx-auto d-block btn btn-secondary" id="source_me"> <hr>
{% trans "I am the emitter" %} <span class="form-control mx-auto d-block btn btn-secondary" id="source_me">
</span> {% trans "I am the emitter" %}
</span>
</div>
</div> </div>
</div> </div>
</div> </div>