-add baron can change password of users
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
Name:<br><input type="text" name="longname" required value="{{user_to_edit.longname}}" /><br>
|
Name:<br><input type="text" name="longname" required value="{{user_to_edit.longname}}" /><br>
|
||||||
Email:<br><input type="email" name="email" required value="{{user_to_edit.email}}" /><br>
|
Email:<br><input type="email" name="email" required value="{{user_to_edit.email}}" /><br>
|
||||||
Euml ID: (falls mehrere durch ; trennen)<br><input type="text" name="rfid_id" value="{{user_to_edit.rfid_id}}" /><br>
|
Euml ID: (falls mehrere durch ; trennen)<br><input type="text" name="rfid_id" value="{{user_to_edit.rfid_id}}" /><br>
|
||||||
|
Neues Passwort: (wenn nicht ausgefüllt bleibt das alte)<br><input type="password" name="new_password" value="" /><br>
|
||||||
Geschwärzt: <input type="checkbox" name="isblack" {% if user_to_edit.isblack %} checked {% endif %} /> <br>
|
Geschwärzt: <input type="checkbox" name="isblack" {% if user_to_edit.isblack %} checked {% endif %} /> <br>
|
||||||
Baron: <input type="checkbox" name="isbaron" {% if user_to_edit.isbaron %} checked {% endif %} /> <br>
|
Baron: <input type="checkbox" name="isbaron" {% if user_to_edit.isbaron %} checked {% endif %} /> <br>
|
||||||
Angezeigt: <input type="checkbox" name="isshown" {% if user_to_edit.isshown %} checked {% endif %} /><br>
|
Angezeigt: <input type="checkbox" name="isshown" {% if user_to_edit.isshown %} checked {% endif %} /><br>
|
||||||
|
|||||||
@@ -134,6 +134,12 @@ def manage_users_edit(name=None):
|
|||||||
u.email = request.form['email']
|
u.email = request.form['email']
|
||||||
u.rfid_id = request.form['rfid_id']
|
u.rfid_id = request.form['rfid_id']
|
||||||
|
|
||||||
|
if len(request.form['new_password']) > 0:
|
||||||
|
u.password = bcrypt.hashpw(request.form['new_password'], bcrypt.gensalt())
|
||||||
|
else:
|
||||||
|
u2 = get_user_by_id(u.id)
|
||||||
|
u.password = u2.password
|
||||||
|
|
||||||
if 'isblack' in request.form:
|
if 'isblack' in request.form:
|
||||||
u.isblack = True
|
u.isblack = True
|
||||||
else:
|
else:
|
||||||
@@ -159,9 +165,6 @@ def manage_users_edit(name=None):
|
|||||||
else:
|
else:
|
||||||
u.onlyrfid = False
|
u.onlyrfid = False
|
||||||
|
|
||||||
u2 = get_user_by_id(u.id)
|
|
||||||
u.password = u2.password
|
|
||||||
|
|
||||||
update_user(u)
|
update_user(u)
|
||||||
|
|
||||||
return redirect('/manage_users')
|
return redirect('/manage_users')
|
||||||
|
|||||||
Reference in New Issue
Block a user