mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-27 07:02:26 +00:00
Fix #217
This commit is contained in:
parent
55b2ff076a
commit
3f9d613c3d
4 changed files with 28 additions and 1 deletions
|
@ -0,0 +1,20 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.11.23 on 2019-09-09 09:50
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('preferences', '0060_auto_20190712_1821'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='optionaluser',
|
||||||
|
name='allow_archived_connexion',
|
||||||
|
field=models.BooleanField(default=False, help_text='If True, archived users are allowed to connect.'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -123,6 +123,10 @@ class OptionalUser(AclMixin, PreferencesModel):
|
||||||
help_text=_("If True, all new created and connected users are active."
|
help_text=_("If True, all new created and connected users are active."
|
||||||
" If False, only when a valid registration has been paid.")
|
" If False, only when a valid registration has been paid.")
|
||||||
)
|
)
|
||||||
|
allow_archived_connexion = models.BooleanField(
|
||||||
|
default=False,
|
||||||
|
help_text=_("If True, archived users are allowed to connect.")
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
permissions = (
|
permissions = (
|
||||||
|
|
|
@ -125,6 +125,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "All users are active by default" %}</th>
|
<th>{% trans "All users are active by default" %}</th>
|
||||||
<td>{{ useroptions.all_users_active|tick }}</td>
|
<td>{{ useroptions.all_users_active|tick }}</td>
|
||||||
|
<th>{% trans "Allow archived users to log-in" %}</th>
|
||||||
|
<td>{{ useroptions.allow_archived_connexion|tick }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
|
@ -333,7 +333,8 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
|
||||||
@property
|
@property
|
||||||
def is_active(self):
|
def is_active(self):
|
||||||
""" Renvoie si l'user est à l'état actif"""
|
""" Renvoie si l'user est à l'état actif"""
|
||||||
return self.state == self.STATE_ACTIVE or self.state == self.STATE_NOT_YET_ACTIVE
|
allow_archived = OptionalUser.get_cached_value('allow_archived_connexion')
|
||||||
|
return self.state == self.STATE_ACTIVE or self.state == self.STATE_NOT_YET_ACTIVE or (allow_archived and self.state in (self.STATE_ARCHIVE, self.STATE_FULL_ARCHIVE))
|
||||||
|
|
||||||
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
|
||||||
|
|
Loading…
Reference in a new issue