diff --git a/api/views.py b/api/views.py
index 5dae2bba..58730754 100644
--- a/api/views.py
+++ b/api/views.py
@@ -513,9 +513,8 @@ class HomeCreationViewSet(viewsets.ReadOnlyModelViewSet):
queryset = users.User.objects.exclude(
Q(state=users.User.STATE_DISABLED)
| Q(state=users.User.STATE_NOT_YET_ACTIVE)
- | Q(state=users.User.STATE_EMAIL_NOT_YET_CONFIRMED)
+ | Q(state=users.STATE_EMAIL_NOT_YET_CONFIRMED)
| Q(state=users.User.STATE_FULL_ARCHIVE)
- | Q(state=users.User.STATE_SUSPENDED)
)
serializer_class = serializers.BasicUserSerializer
diff --git a/logs/locale/fr/LC_MESSAGES/django.po b/logs/locale/fr/LC_MESSAGES/django.po
index 6268b05b..92dbb89b 100644
--- a/logs/locale/fr/LC_MESSAGES/django.po
+++ b/logs/locale/fr/LC_MESSAGES/django.po
@@ -247,10 +247,6 @@ msgstr "Utilisateurs pas encore actifs"
msgid "Waiting for email confirmation users"
msgstr "Utilisateurs en attente de confirmation d'email"
-#: logs/views.py:273
-msgid "Suspended users"
-msgstr "Utilisateurs suspendus"
-
#: logs/views.py:273
msgid "Contributing members"
msgstr "Adhérents cotisants"
diff --git a/logs/views.py b/logs/views.py
index 69ec5635..615fb69b 100644
--- a/logs/views.py
+++ b/logs/views.py
@@ -270,16 +270,6 @@ def stats_general(request):
),
Club.objects.filter(state=Club.STATE_EMAIL_NOT_YET_CONFIRMED).count(),
],
- "suspended_users": [
- _("Suspended users"),
- User.objects.filter(state=User.STATE_SUSPENDED).count(),
- (
- Adherent.objects.filter(
- state=Adherent.STATE_SUSPENDED
- ).count()
- ),
- Club.objects.filter(state=Club.STATE_SUSPENDED).count(),
- ],
"adherent_users": [
_("Contributing members"),
_all_adherent.count(),
diff --git a/preferences/forms.py b/preferences/forms.py
index 1fdefa6a..b296c0d4 100644
--- a/preferences/forms.py
+++ b/preferences/forms.py
@@ -66,7 +66,7 @@ class EditOptionalUserForm(ModelForm):
self.fields["gpg_fingerprint"].label = _("GPG fingerprint")
self.fields["all_can_create_club"].label = _("All can create a club")
self.fields["all_can_create_adherent"].label = _("All can create a member")
- self.fields["suspend_emailnotyetconfirmed"].label = _("Delay before suspending accounts without a verified email")
+ self.fields["disable_emailnotyetconfirmed"].label = _("Delay before disabling accounts without a verified email")
self.fields["self_adhesion"].label = _("Self registration")
self.fields["shell_default"].label = _("Default shell")
self.fields["allow_set_password_during_user_creation"].label = _("Allow directly setting a password during account creation")
diff --git a/preferences/locale/fr/LC_MESSAGES/django.po b/preferences/locale/fr/LC_MESSAGES/django.po
index caa5719c..e7ac2e66 100644
--- a/preferences/locale/fr/LC_MESSAGES/django.po
+++ b/preferences/locale/fr/LC_MESSAGES/django.po
@@ -287,11 +287,11 @@ msgstr ""
#: preferences/models.py:111
msgid ""
-"Users with an email address not yet confirmed will be suspended after"
+"Users with an email address not yet confirmed will be disabled after"
" this number of days."
msgstr ""
"Les utilisateurs n'ayant pas confirmé leur addresse mail seront"
-" suspendus après ce nombre de jours"
+" désactivés après ce nombre de jours"
#: preferences/models.py:114
msgid "A new user can create their account on Re2o."
@@ -1083,8 +1083,8 @@ msgid "Allow directly entering a password during account creation"
msgstr "Permettre le choix d'un mot de passe directement lors de la création du compte"
#: preferences/templates/preferences/display_preferences.html:136
-msgid "Delay before suspending accounts without a verified email"
-msgstr "Délai avant la suspension des comptes sans adresse mail confirmé"
+msgid "Delay before disabling accounts without a verified email"
+msgstr "Délai avant la désactivation des comptes sans adresse mail confirmé"
#: preferences/templates/preferences/display_preferences.html:136
msgid "Users general permissions"
diff --git a/preferences/migrations/0069_optionaluser_disable_emailnotyetconfirmed.py b/preferences/migrations/0069_optionaluser_disable_emailnotyetconfirmed.py
index 137211ff..3cc12081 100644
--- a/preferences/migrations/0069_optionaluser_disable_emailnotyetconfirmed.py
+++ b/preferences/migrations/0069_optionaluser_disable_emailnotyetconfirmed.py
@@ -14,8 +14,8 @@ class Migration(migrations.Migration):
operations = [
migrations.AddField(
model_name='optionaluser',
- name='suspend_emailnotyetconfirmed',
- field=models.IntegerField(default=2, help_text='Users with an email address not yet confirmed will be suspended after this number of days.')
+ name='disable_emailnotyetconfirmed',
+ field=models.IntegerField(default=2, help_text='Users with an email address not yet confirmed will be disabled after this number of days.')
),
]
diff --git a/preferences/models.py b/preferences/models.py
index 360f2e51..e470303d 100644
--- a/preferences/models.py
+++ b/preferences/models.py
@@ -107,10 +107,10 @@ class OptionalUser(AclMixin, PreferencesModel):
"Not yet active users will be deleted after this number of days."
),
)
- suspend_emailnotyetconfirmed = models.IntegerField(
+ disable_emailnotyetconfirmed = models.IntegerField(
default=2,
help_text=_(
- "Users with an email address not yet confirmed will be suspended after this number of days."
+ "Users with an email address not yet confirmed will be disabled after this number of days."
),
)
self_adhesion = models.BooleanField(
diff --git a/preferences/templates/preferences/display_preferences.html b/preferences/templates/preferences/display_preferences.html
index 6ccb1b2f..8eb75918 100644
--- a/preferences/templates/preferences/display_preferences.html
+++ b/preferences/templates/preferences/display_preferences.html
@@ -131,8 +131,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% trans "Allow directly entering a password during account creation" %} |
{{ useroptions.allow_set_password_during_user_creation|tick }} |
- {% trans "Delay before suspending accounts without a verified email" %} |
- {% blocktrans with suspend_emailnotyetconfirmed=useroptions.suspend_emailnotyetconfirmed %}{{ suspend_emailnotyetconfirmed }} days{% endblocktrans %} |
+ {% trans "Delay before disabling accounts without a verified email" %} |
+ {% blocktrans with disable_emailnotyetconfirmed=useroptions.disable_emailnotyetconfirmed %}{{ disable_emailnotyetconfirmed }} days{% endblocktrans %} |
diff --git a/search/forms.py b/search/forms.py
index a49b92e7..741a15e8 100644
--- a/search/forms.py
+++ b/search/forms.py
@@ -36,7 +36,6 @@ CHOICES_USER = (
("3", _("Not yet active")),
("4", _("Fully archived")),
("5", _("Waiting for email confirmation")),
- ("6", _("Suspended")),
)
CHOICES_AFF = (
diff --git a/search/locale/fr/LC_MESSAGES/django.po b/search/locale/fr/LC_MESSAGES/django.po
index 4c34f29d..6da1a477 100644
--- a/search/locale/fr/LC_MESSAGES/django.po
+++ b/search/locale/fr/LC_MESSAGES/django.po
@@ -54,10 +54,6 @@ msgstr "Complètement archivés"
msgid "Waiting for email confirmation"
msgstr "En attente de confirmation d'email"
-#: search/forms.py:39
-msgid "Suspended"
-msgstr "Suspendu"
-
#: search/forms.py:41
msgid "Users"
msgstr "Utilisateurs"
diff --git a/users/forms.py b/users/forms.py
index 52f4232b..ad5c3708 100644
--- a/users/forms.py
+++ b/users/forms.py
@@ -388,14 +388,10 @@ class AdherentForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
if not self.is_anon and self.initial["email"] and user.email != self.initial["email"]:
# Send a confirmation email
- # Don't do this for archived or disabled users
- if user.state not in [User.STATE_ARCHIVE, User.STATE_FULL_ARCHIVE, User.STATE_DISABLED]:
+ if user.state in [User.STATE_ACTIVE, User.STATE_DISABLED, User.STATE_NOT_YET_ACTIVE, User.STATE_EMAIL_NOT_YET_CONFIRMED]:
+ user.state = User.STATE_EMAIL_NOT_YET_CONFIRMED
self.should_send_confirmation_email = True
- # Suspend users stay suspended
- if user.state == User.STATE_SUSPENDED:
- user.state = User.STATE_EMAIL_NOT_YET_CONFIRMED
-
# Always keep the oldest change date
if user.email_change_date is None:
user.email_change_date = timezone.now()
diff --git a/users/management/commands/clean_notyetactive.py b/users/management/commands/clean_notyetactive.py
index 5ca68827..d1857096 100644
--- a/users/management/commands/clean_notyetactive.py
+++ b/users/management/commands/clean_notyetactive.py
@@ -28,13 +28,13 @@ from django.utils import timezone
class Command(BaseCommand):
- help = "Delete non members users (not yet active or suspended too long ago without an invoice)."
+ help = "Delete non members users (not yet active or disabled too long ago without an invoice)."
def handle(self, *args, **options):
"""First deleting invalid invoices, and then deleting the users"""
- days = OptionalUser.get_cached_value("delete_notyetactive")
+ days = OptionalUser.get_cached_value("disable_emailnotyetconfirmed")
users_to_delete = (
- User.objects.filter(Q(state=User.STATE_NOT_YET_ACTIVE) | Q(state=User.STATE_SUSPENDED))
+ User.objects.filter(Q(state=User.STATE_NOT_YET_ACTIVE) | Q(state=User.STATE_DISABLED))
.filter(registered__lte=timezone.now() - timedelta(days=days))
.exclude(facture__valid=True)
.distinct()
diff --git a/users/management/commands/disable_emailnotyetconfirmed.py b/users/management/commands/disable_emailnotyetconfirmed.py
index e0cd6d5e..955234e5 100644
--- a/users/management/commands/disable_emailnotyetconfirmed.py
+++ b/users/management/commands/disable_emailnotyetconfirmed.py
@@ -25,19 +25,19 @@ from django.utils import timezone
class Command(BaseCommand):
- help = "Suspend users who haven't confirmed their email."
+ help = "Disable users who haven't confirmed their email."
def handle(self, *args, **options):
"""First deleting invalid invoices, and then deleting the users"""
- days = OptionalUser.get_cached_value("suspend_emailnotyetconfirmed")
- users_to_suspend = (
+ days = OptionalUser.get_cached_value("disable_emailnotyetconfirmed")
+ users_to_disable = (
User.objects.filter(state=User.STATE_EMAIL_NOT_YET_CONFIRMED)
.filter(email_change_date__lte=timezone.now() - timedelta(days=days))
.distinct()
)
- print("Suspending " + str(users_to_suspend.count()) + " users.")
+ print("Disabling " + str(users_to_disable.count()) + " users.")
- for user in users_to_suspend:
- user.state = User.STATE_SUSPENDED
- user.notif_suspension()
+ for user in users_to_disable:
+ user.state = User.STATE_DISABLED
+ user.notif_disable()
user.save()
diff --git a/users/models.py b/users/models.py
index 36884115..397dc7f3 100755
--- a/users/models.py
+++ b/users/models.py
@@ -174,13 +174,12 @@ class User(
Champs principaux : name, surnname, pseudo, email, room, password
Herite du django BaseUser et du système d'auth django"""
- STATE_ACTIVE = 0 # Can login and has Internet (if invoice is valid)
- STATE_DISABLED = 1 # Cannot login to Re2o and doesn't have Internet
+ STATE_ACTIVE = 0
+ STATE_DISABLED = 1
STATE_ARCHIVE = 2
STATE_NOT_YET_ACTIVE = 3
STATE_FULL_ARCHIVE = 4
STATE_EMAIL_NOT_YET_CONFIRMED = 5
- STATE_SUSPENDED = 6 # Can login to Re2o but doesn't have Internet
STATES = (
(0, _("Active")),
(1, _("Disabled")),
@@ -188,7 +187,6 @@ class User(
(3, _("Not yet active")),
(4, _("Fully archived")),
(5, _("Waiting for email confirmation")),
- (5, _("Suspended")),
)
surname = models.CharField(max_length=255)
@@ -397,7 +395,7 @@ class User(
@cached_property
def get_shadow_expire(self):
"""Return the shadow_expire value for the user"""
- if self.state == self.STATE_DISABLED or self.STATE_SUSPENDED:
+ if self.state == self.STATE_DISABLED:
return str(0)
else:
return None
@@ -692,7 +690,6 @@ class User(
or self.state == self.STATE_EMAIL_NOT_YET_CONFIRMED
or self.state == self.STATE_ARCHIVE
or self.state == self.STATE_DISABLED
- or self.state == self.STATE_SUSPENDED
):
self.refresh_from_db()
try:
@@ -813,7 +810,7 @@ class User(
if self.email_change_date is None or self.state != self.STATE_EMAIL_NOT_YET_CONFIRMED:
return None
- days = OptionalUser.get_cached_value("suspend_emailnotyetconfirmed")
+ days = OptionalUser.get_cached_value("disable_emailnotyetconfirmed")
return self.email_change_date + timedelta(days=days)
def confirm_email_address_mail(self, request):
@@ -900,9 +897,9 @@ class User(
)
return
- def notif_suspension(self):
+ def notif_disable(self):
"""Envoi un mail de notification informant que l'adresse mail n'a pas été confirmée"""
- template = loader.get_template("users/email_suspension_notif")
+ template = loader.get_template("users/email_disable_notif")
context = {
"name": self.get_full_name(),
"asso_name": AssoOption.get_cached_value("name"),
diff --git a/users/templates/users/email_suspension_notif b/users/templates/users/email_disable_notif
similarity index 100%
rename from users/templates/users/email_suspension_notif
rename to users/templates/users/email_disable_notif
diff --git a/users/templates/users/profil.html b/users/templates/users/profil.html
index e6878927..ed613537 100644
--- a/users/templates/users/profil.html
+++ b/users/templates/users/profil.html
@@ -50,7 +50,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% blocktrans %}Didn't receive the email?{% endblocktrans %}
-{% elif users.state == users.STATE_SUSPENDED %}
+{% elif users.state == users.STATE_DISABLED %}
{% blocktrans %}Your account has been suspended.{% endblocktrans %}
diff --git a/users/views.py b/users/views.py
index 0f7fee24..fb5f8d73 100644
--- a/users/views.py
+++ b/users/views.py
@@ -981,7 +981,7 @@ def reset_password(request):
user = User.objects.get(
pseudo=userform.cleaned_data["pseudo"],
email=userform.cleaned_data["email"],
- state__in=[User.STATE_ACTIVE, User.STATE_NOT_YET_ACTIVE, User.STATE_EMAIL_NOT_YET_CONFIRMED, User.STATE_SUSPENDED],
+ state__in=[User.STATE_ACTIVE, User.STATE_NOT_YET_ACTIVE, User.STATE_EMAIL_NOT_YET_CONFIRMED],
)
except User.DoesNotExist:
messages.error(request, _("The user doesn't exist."))