1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-11-08 21:21:06 +00:00

Prevent admin lockout

This commit is contained in:
Mo 2021-11-29 20:58:14 +01:00
parent 5a03a558c8
commit 490eb8e14c

View file

@ -169,6 +169,8 @@ class UserView(SecureAdminModelView):
if not is_created:
if model == current_user and not form.active.data:
raise ModelViewException("Tried to deactiavte yourself as user!")
if not model.has_role("admin"):
raise ModelViewException("Tried to remove your admin role!")
if hasattr(form, "generate_new_password") and form.generate_new_password.data:
password = randomPassword()