From 9c5ed967ece89a94ab0736b65b0fa548782b89e6 Mon Sep 17 00:00:00 2001 From: knedlik Date: Fri, 19 Dec 2025 08:27:36 +0100 Subject: [PATCH] Add field 'acitve' to user authentication --- app/app_db/app.db | Bin 69632 -> 69632 bytes app/auth.py | 2 +- app/pages/user.py | 13 +++++++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/app_db/app.db b/app/app_db/app.db index 27385d3015eac31fe1293f57ffde1a78617b06e7..6f83a8875b2b94678bbfd43ad99ea0838ff74a5d 100644 GIT binary patch delta 89 zcmZozz|ydQWr8&0!ih4@tP2_Rk{LIq7}zp#a7>?3-Ja7myf{ tXIPY{SDaIs8ktuXP!Up|?w93VYHDfe6mIBM=wjeo9^!7c`K7J+B>)Z;9u@!q delta 89 zcmZozz|ydQWr8&0{E0Hotn(T4dVg+AF|cLg dict: with closing(get_conn()) as conn: rows = conn.execute( - "SELECT username, email, password_hash FROM users" + "SELECT username, email, password_hash FROM users where active = 1" ).fetchall() for username, email, pw_hash in rows: diff --git a/app/pages/user.py b/app/pages/user.py index 16e418d..9d9379c 100644 --- a/app/pages/user.py +++ b/app/pages/user.py @@ -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):