diff --git a/app/app_db/app.db b/app/app_db/app.db index 27385d3..6f83a88 100644 Binary files a/app/app_db/app.db and b/app/app_db/app.db differ diff --git a/app/auth.py b/app/auth.py index 6b7d1c1..f524b80 100644 --- a/app/auth.py +++ b/app/auth.py @@ -163,7 +163,7 @@ def load_credentials_from_db() -> 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):