Add field 'acitve' to user authentication

This commit is contained in:
knedlik
2025-12-19 08:27:36 +01:00
parent 37d1daa052
commit 9c5ed967ec
3 changed files with 10 additions and 5 deletions

View File

@@ -120,8 +120,11 @@ def dialog_modify_user(id):
idx = roles.index(role)
except:
idx = None
txt_username = st.text_input(label="Benutzername", value=df.iloc[0]["user"])
col1, col2 = st.columns([2,1],vertical_alignment="center")
with col1:
txt_username = st.text_input(label="Benutzername", value=df.iloc[0]["user"])
with col2:
is_active = st.checkbox(label="Aktiv", value=df.iloc[0]["active"])
txt_firstname = st.text_input(label="Vorname", value=df.iloc[0]["firstname"])
txt_lastname = st.text_input(label="Nachname", value=df.iloc[0]["lastname"])
txt_email = st.text_input(label="Email", value=df.iloc[0]["email"])
@@ -137,6 +140,7 @@ def dialog_modify_user(id):
sql = """
update users set
username = ?,
active = ?,
firstname = ?,
lastname = ?,
email = ?,
@@ -145,12 +149,13 @@ def dialog_modify_user(id):
role_id = ?
where id = ?
"""
params = (txt_username, txt_firstname, txt_lastname, txt_email, pw_hash, new_pwd, get_id(cmb_role), id)
params = (txt_username, is_active, txt_firstname, txt_lastname, txt_email, pw_hash, new_pwd, get_id(cmb_role), id)
# send_cmd(sql,(txt_username, txt_firstname, txt_lastname, txt_email, pw_hash, new_pwd, get_id(cmb_role), id))
else:
sql = """
update users set
username = ?,
active = ?,
firstname = ?,
lastname = ?,
email = ?,
@@ -158,7 +163,7 @@ def dialog_modify_user(id):
role_id = ?
where id = ?
"""
params = (txt_username, txt_firstname, txt_lastname, txt_email, new_pwd, get_id(cmb_role), id)
params = (txt_username, is_active, txt_firstname, txt_lastname, txt_email, new_pwd, get_id(cmb_role), id)
# send_cmd(sql,(txt_username, txt_firstname, txt_lastname, txt_email, new_pwd, get_id(cmb_role), id))
print (params)
if send_cmd(sql, params):