fix: [users settings] fix user edit

This commit is contained in:
terrtia 2024-08-13 16:27:37 +02:00
parent 4dcc8c8d34
commit b66859d639
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0
2 changed files with 7 additions and 2 deletions

View file

@ -306,7 +306,7 @@ def create_user(user_id, password=None, admin_id=None, chg_passwd=True, role=Non
# EDIT
if exists_user(user_id):
if password or chg_passwd:
edit_user(user_id, password_hash, chg_passwd=chg_passwd)
edit_user(user_id, password_hash, chg_passwd=chg_passwd, otp=otp)
if role:
edit_user_role(user_id, role)
# CREATE USER

View file

@ -49,7 +49,12 @@
<h1 class="h3 mt-1 mb-3 text-center text-secondary">{% if meta['id'] %}Edit{% else %}Create{% endif %} User</h1>
<label for="inputEmail" class="sr-only">Email address</label>
<input type="email" id="inputEmail" name="username" class="form-control {% if error_mail %}is-invalid{% endif %}" placeholder="Email address" autocomplete="off" required {% if meta['id'] %}value="{{ meta['id'] }}"{% endif %} {% if meta['id'] %}disabled{% endif %}>
{% if meta['id'] %}
<input type="email" id="inputEmail" class="form-control" placeholder="Email address" autocomplete="off" value="{{ meta['id'] }}" disabled>
<input type="email" name="username" hidden="" value="{{ meta['id'] }}">
{% else %}
<input type="email" id="inputEmail" name="username" class="form-control {% if error_mail %}is-invalid{% endif %}" placeholder="Email address" autocomplete="off" required>
{% endif %}
{% if error_mail %}
<div class="invalid-feedback">Please provide a valid email address</div>
{% endif %}