admin: ADD suivi des comptes inactifs, validation manuelle (#58)

This commit is contained in:
Darks 2020-07-23 19:12:37 +02:00
parent 6cec9bf8ee
commit 889a091030
Signed by: Darks
GPG Key ID: F61F10FA138E797C
5 changed files with 25 additions and 21 deletions

View File

@ -189,8 +189,8 @@ class AdminUpdateAccountForm(FlaskForm):
vd.email,
],
)
email_validate = BooleanField(
"Envoyer un email de validation à la nouvelle adresse",
email_confirmed = BooleanField(
"Confirmer l'email",
description="Si décoché, l'utilisateur devra demander explicitement un email "\
"de validation, ou faire valider son adresse email par un administrateur.",
)

View File

@ -160,14 +160,15 @@ class Member(User):
"""
Update all or part of the user's metadata. The [data] dictionary
accepts the following keys:
"email" str User mail ddress
"password" str Raw password
"bio" str Biograpy
"signature" str Post signature
"birthday" date Birthday date
"newsletter" bool Newsletter setting
"xp" int Experience points
"avatar" File Avatar image
"email" str User mail address
"email_confirmed" bool User mail address confirmed
"password" str Raw password
"bio" str Biograpy
"signature" str Post signature
"birthday" date Birthday date
"newsletter" bool Newsletter setting
"xp" int Experience points
"avatar" File Avatar image
For future compatibility, other attributes are silently ignored. None
values can be specified and are ignored.
@ -198,6 +199,8 @@ class Member(User):
self.set_avatar(data["avatar"])
# For admins only
if "email_confirmed" in data:
self.email_confirmed = data["email_confirmed"]
if "xp" in data:
self.xp = data["xp"]

View File

@ -48,6 +48,7 @@ def adm_edit_account(user_id):
avatar=form.avatar.data or None,
name=form.username.data or None,
email=form.email.data or None,
email_confirmed=form.email_confirmed.data,
password=form.password.data or None,
birthday=form.birthday.data,
signature=form.signature.data,

View File

@ -37,9 +37,9 @@
{% endfor %}
</div>
<div>
{{ form.email_validate.label }}
{{ form.email_validate(checked=True) }}
<div class=desc>{{ form.email_validate.description }}</div>
{{ form.email_confirmed.label }}
{{ form.email_confirmed(checked=user.email_confirmed) }}
<div class=desc>{{ form.email_confirmed.description }}</div>
</div>
<div>
{{ form.password.label }}

View File

@ -13,19 +13,19 @@
<table style="width:90%; margin: auto;">
<tr><th>Pseudo</th><th>Email</th><th>Groupes</th>
<th>Privilèges spéciaux</th><th>Modifier</th></tr>
<th>Privilèges spéciaux</th><th>Modifier</th></tr>
{% for user in users %}
<tr><td><a href="{{ url_for('user_by_id', user_id=user.id) }}" title="Page de profil publique de {{ user.name }}">{{ user.name }}</a></td>
<td>{{ user.email }}</td>
<td style="color: {{ 'red' if not user.email_confirmed else 'inherit' }};">{{ user.email }}</td>
<td>{% for g in user.groups %}
<span style="{{ g.css }}">{{ g.name }}</span>
{{ ', ' if not loop.last }}
{% endfor %}</td>
<span style="{{ g.css }}">{{ g.name }}</span>
{{ ', ' if not loop.last }}
{% endfor %}</td>
<td>{% for priv in user.special_privileges() %}
<code>{{ priv }}</code>
{{- ', ' if not loop.last }}
{% endfor %}</td>
<code>{{ priv }}</code>
{{- ', ' if not loop.last }}
{% endfor %}</td>
<td style="text-align: center"><a href="{{ url_for('adm_edit_account', user_id=user.id) }}">Modifier</a></td>
</tr>
{% endfor %}