mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-12-20 23:41:20 +00:00
Prevent admin lockout
This commit is contained in:
parent
5a03a558c8
commit
490eb8e14c
1 changed files with 2 additions and 0 deletions
|
@ -169,6 +169,8 @@ class UserView(SecureAdminModelView):
|
||||||
if not is_created:
|
if not is_created:
|
||||||
if model == current_user and not form.active.data:
|
if model == current_user and not form.active.data:
|
||||||
raise ModelViewException("Tried to deactiavte yourself as user!")
|
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:
|
if hasattr(form, "generate_new_password") and form.generate_new_password.data:
|
||||||
password = randomPassword()
|
password = randomPassword()
|
||||||
|
|
Loading…
Reference in a new issue