Compare commits

..

No commits in common. "82aa0182e3fa96606961af53e012e224e1dbff42" and "d7b834d9089e647084944b37ae4e24f3a03e5a72" have entirely different histories.

8 changed files with 77 additions and 92 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,7 +108,6 @@ 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,8 +24,7 @@ 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.email) + str(user.profile.email_confirmed)\ return str(user.pk) + str(user.profile.email_confirmed) + str(login_timestamp) + str(timestamp)
+ 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 email")} extra_context = {"title": _("Validate a registration")}
def get(self, *args, **kwargs): def get(self, *args, **kwargs):
""" """
@ -93,13 +93,16 @@ 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):
# The user must wait that someone validates the account before the user can be active and login.
self.validlink = True self.validlink = True
# The user must wait that someone validates the account before the user can be active and login.
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 self.render_to_response(self.get_context_data()) return super().dispatch(*args, **kwargs)
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-08-01 10:47+0200\n" "POT-Creation-Date: 2020-07-31 22:25+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,10 +456,6 @@ 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
@ -537,7 +533,7 @@ msgstr ""
msgid "fee" msgid "fee"
msgstr "" msgstr ""
#: apps/member/models.py:303 apps/member/views.py:535 apps/wei/views.py:797 #: apps/member/models.py:303 apps/member/views.py:534 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 ""
@ -546,7 +542,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:544 #: apps/member/models.py:321 apps/member/views.py:543
msgid "User is already a member of the club" msgid "User is already a member of the club"
msgstr "" msgstr ""
@ -577,71 +573,71 @@ msgstr ""
msgid "This address must be valid." msgid "This address must be valid."
msgstr "" msgstr ""
#: apps/member/views.py:128 #: apps/member/views.py:127
msgid "Profile detail" msgid "Profile detail"
msgstr "" msgstr ""
#: apps/member/views.py:162 #: apps/member/views.py:161
msgid "Search user" msgid "Search user"
msgstr "" msgstr ""
#: apps/member/views.py:196 apps/member/views.py:382 #: apps/member/views.py:195 apps/member/views.py:381
msgid "Note aliases" msgid "Note aliases"
msgstr "" msgstr ""
#: apps/member/views.py:210 #: apps/member/views.py:209
msgid "Update note picture" msgid "Update note picture"
msgstr "" msgstr ""
#: apps/member/views.py:268 templates/member/profile_info.html:43 #: apps/member/views.py:267 templates/member/profile_info.html:43
msgid "Manage auth token" msgid "Manage auth token"
msgstr "" msgstr ""
#: apps/member/views.py:296 #: apps/member/views.py:295
msgid "Create new club" msgid "Create new club"
msgstr "" msgstr ""
#: apps/member/views.py:308 #: apps/member/views.py:307
msgid "Search club" msgid "Search club"
msgstr "" msgstr ""
#: apps/member/views.py:333 #: apps/member/views.py:332
msgid "Club detail" msgid "Club detail"
msgstr "" msgstr ""
#: apps/member/views.py:399 #: apps/member/views.py:398
msgid "Update club" msgid "Update club"
msgstr "" msgstr ""
#: apps/member/views.py:433 #: apps/member/views.py:432
msgid "Add new member to the club" msgid "Add new member to the club"
msgstr "" msgstr ""
#: apps/member/views.py:530 apps/wei/views.py:788 #: apps/member/views.py:529 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:548 #: apps/member/views.py:547
msgid "The membership must start after {:%m-%d-%Y}." msgid "The membership must start after {:%m-%d-%Y}."
msgstr "" msgstr ""
#: apps/member/views.py:553 #: apps/member/views.py:552
msgid "The membership must begin before {:%m-%d-%Y}." msgid "The membership must begin before {:%m-%d-%Y}."
msgstr "" msgstr ""
#: apps/member/views.py:570 apps/member/views.py:572 apps/member/views.py:574 #: apps/member/views.py:569 apps/member/views.py:571 apps/member/views.py:573
#: apps/registration/views.py:292 apps/registration/views.py:294 #: apps/registration/views.py:295 apps/registration/views.py:297
#: apps/registration/views.py:296 #: apps/registration/views.py:299
msgid "This field is required." msgid "This field is required."
msgstr "" msgstr ""
#: apps/member/views.py:642 #: apps/member/views.py:641
msgid "Manage roles of an user in the club" msgid "Manage roles of an user in the club"
msgstr "" msgstr ""
#: apps/member/views.py:667 #: apps/member/views.py:666
msgid "Members of the club" msgid "Members of the club"
msgstr "" msgstr ""
@ -1055,47 +1051,47 @@ msgid "Email validation"
msgstr "" msgstr ""
#: apps/registration/views.py:82 #: apps/registration/views.py:82
msgid "Validate email" msgid "Validate a registration"
msgstr "" msgstr ""
#: apps/registration/views.py:124 #: apps/registration/views.py:127
msgid "Email validation unsuccessful" msgid "Email validation unsuccessful"
msgstr "" msgstr ""
#: apps/registration/views.py:135 #: apps/registration/views.py:138
msgid "Email validation email sent" msgid "Email validation email sent"
msgstr "" msgstr ""
#: apps/registration/views.py:143 #: apps/registration/views.py:146
msgid "Resend email validation link" msgid "Resend email validation link"
msgstr "" msgstr ""
#: apps/registration/views.py:161 #: apps/registration/views.py:164
msgid "Pre-registered users list" msgid "Pre-registered users list"
msgstr "" msgstr ""
#: apps/registration/views.py:190 #: apps/registration/views.py:193
msgid "Unregistered users" msgid "Unregistered users"
msgstr "" msgstr ""
#: apps/registration/views.py:203 #: apps/registration/views.py:206
msgid "Registration detail" msgid "Registration detail"
msgstr "" msgstr ""
#: apps/registration/views.py:258 #: apps/registration/views.py:261
msgid "You must join the BDE." msgid "You must join the BDE."
msgstr "" msgstr ""
#: apps/registration/views.py:280 #: apps/registration/views.py:283
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:285 #: apps/registration/views.py:288
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:360 #: apps/registration/views.py:363
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-08-01 10:47+0200\n" "POT-Creation-Date: 2020-07-31 22:25+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,10 +457,6 @@ 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
@ -542,7 +538,7 @@ msgstr "l'adhésion finit le"
msgid "fee" msgid "fee"
msgstr "cotisation" msgstr "cotisation"
#: apps/member/models.py:303 apps/member/views.py:535 apps/wei/views.py:797 #: apps/member/models.py:303 apps/member/views.py:534 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"
@ -551,7 +547,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:544 #: apps/member/models.py:321 apps/member/views.py:543
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"
@ -582,47 +578,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:128 #: apps/member/views.py:127
msgid "Profile detail" msgid "Profile detail"
msgstr "Détails de l'utilisateur" msgstr "Détails de l'utilisateur"
#: apps/member/views.py:162 #: apps/member/views.py:161
msgid "Search user" msgid "Search user"
msgstr "Chercher un utilisateur" msgstr "Chercher un utilisateur"
#: apps/member/views.py:196 apps/member/views.py:382 #: apps/member/views.py:195 apps/member/views.py:381
msgid "Note aliases" msgid "Note aliases"
msgstr "Alias de la note" msgstr "Alias de la note"
#: apps/member/views.py:210 #: apps/member/views.py:209
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:268 templates/member/profile_info.html:43 #: apps/member/views.py:267 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:296 #: apps/member/views.py:295
msgid "Create new club" msgid "Create new club"
msgstr "Créer un nouveau club" msgstr "Créer un nouveau club"
#: apps/member/views.py:308 #: apps/member/views.py:307
msgid "Search club" msgid "Search club"
msgstr "Chercher un club" msgstr "Chercher un club"
#: apps/member/views.py:333 #: apps/member/views.py:332
msgid "Club detail" msgid "Club detail"
msgstr "Détails du club" msgstr "Détails du club"
#: apps/member/views.py:399 #: apps/member/views.py:398
msgid "Update club" msgid "Update club"
msgstr "Modifier le club" msgstr "Modifier le club"
#: apps/member/views.py:433 #: apps/member/views.py:432
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:530 apps/wei/views.py:788 #: apps/member/views.py:529 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."
@ -630,25 +626,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:548 #: apps/member/views.py:547
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:553 #: apps/member/views.py:552
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:570 apps/member/views.py:572 apps/member/views.py:574 #: apps/member/views.py:569 apps/member/views.py:571 apps/member/views.py:573
#: apps/registration/views.py:292 apps/registration/views.py:294 #: apps/registration/views.py:295 apps/registration/views.py:297
#: apps/registration/views.py:296 #: apps/registration/views.py:299
msgid "This field is required." msgid "This field is required."
msgstr "Ce champ est requis." msgstr "Ce champ est requis."
#: apps/member/views.py:642 #: apps/member/views.py:641
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:667 #: apps/member/views.py:666
msgid "Members of the club" msgid "Members of the club"
msgstr "Membres du club" msgstr "Membres du club"
@ -1080,49 +1076,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 email" msgid "Validate a registration"
msgstr "Valider l'adresse e-mail" msgstr "Valider l'inscription"
#: apps/registration/views.py:124 #: apps/registration/views.py:127
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:135 #: apps/registration/views.py:138
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:143 #: apps/registration/views.py:146
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:161 #: apps/registration/views.py:164
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:190 #: apps/registration/views.py:193
msgid "Unregistered users" msgid "Unregistered users"
msgstr "Utilisateurs en attente d'inscription" msgstr "Utilisateurs en attente d'inscription"
#: apps/registration/views.py:203 #: apps/registration/views.py:206
msgid "Registration detail" msgid "Registration detail"
msgstr "Détails de l'inscription" msgstr "Détails de l'inscription"
#: apps/registration/views.py:258 #: apps/registration/views.py:261
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:280 #: apps/registration/views.py:283
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:285 #: apps/registration/views.py:288
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:360 #: apps/registration/views.py:363
msgid "Invalidate pre-registration" msgid "Invalidate pre-registration"
msgstr "Invalider l'inscription" msgstr "Invalider l'inscription"
@ -2664,6 +2660,3 @@ 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,7 +80,6 @@ $(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');
@ -89,7 +88,6 @@ $(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');
@ -107,7 +105,6 @@ $(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,12 +55,10 @@ 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..." %}" />
<div id="source_me_div"> <hr>
<hr> <span class="form-control mx-auto d-block btn btn-secondary" id="source_me">
<span class="form-control mx-auto d-block btn btn-secondary" id="source_me"> {% trans "I am the emitter" %}
{% trans "I am the emitter" %} </span>
</span>
</div>
</div> </div>
</div> </div>
</div> </div>