diff --git a/reports/access_points_page.py b/reports/access_points_page.py index b22163c..30da4da 100644 --- a/reports/access_points_page.py +++ b/reports/access_points_page.py @@ -1161,6 +1161,501 @@ def render_observation_table(observations): """ +def render_wifi_connection_card(ap, credentials): + is_open = ap["encryption"] == "OPEN" + + password_states = {} + + for credential in credentials: + password = credential["password"] + + if not password: + continue + + if password not in password_states: + password_states[password] = bool( + credential["verified"] + ) + elif credential["verified"]: + password_states[password] = True + + credential_rows = [] + + for password, verified in password_states.items(): + if verified: + verify_button = """ + +""" + connect_disabled = "" + status_text = "Пароль успешно проверен" + else: + verify_button = """ + +""" + connect_disabled = "disabled" + status_text = "Пароль ещё не проверен" + + credential_rows.append( + f""" +
+
+ Password: + {esc(password)} +
+ +
+ {status_text} +
+ +
+ {verify_button} + + +
+
+""" + ) + + if is_open: + actions_html = """ +
+

+ Эта точка доступа не использует пароль. + Проверка пароля не требуется. +

+ + +
+""" + elif credential_rows: + actions_html = "".join(credential_rows) + else: + actions_html = """ +
+ В базе данных нет сохранённых паролей для этой точки доступа. +
+""" + + return card( + "Проверка пароля и подключение", + f""" +
+
+ + + +
+ + + +
+ +
+ {actions_html} +
+
+ + +""" + ) def render_access_point_page( conn,