Skip to content

Commit 25a8155

Browse files
committed
Refactor: Simplify login redirection logic and clean up UI test code
1 parent 39f617b commit 25a8155

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

front/php/templates/security.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ function redirect($url) {
8383
$isLoggedIn = isset($_SESSION['login']) && $_SESSION['login'] == 1;
8484

8585
// Determine if the user should be redirected
86-
if ($isLoggedIn || $isLogonPage || (isset($_COOKIE[COOKIE_SAVE_LOGIN_NAME]) && $nax_Password === $_COOKIE[COOKIE_SAVE_LOGIN_NAME])) {
86+
if ($isLoggedIn || $isLogonPage) {
8787
// Logged in or stay on this page if we are on the index.php already
8888
} else {
8989
// We need to redirect

test/ui/test_ui_login.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@
99
import time
1010

1111
from selenium.webdriver.common.by import By
12-
from selenium.webdriver.support.ui import WebDriverWait
13-
from selenium.webdriver.support import expected_conditions as EC
1412

1513
# Add test directory to path
1614
sys.path.insert(0, os.path.dirname(__file__))
1715

18-
from .test_helpers import BASE_URL, wait_for_page_load, wait_for_element_by_css # noqa: E402
16+
from .test_helpers import BASE_URL, wait_for_page_load # noqa: E402
1917

2018

2119
def get_login_password():
@@ -32,7 +30,6 @@ def get_login_password():
3230
# SHA256 hash of "password" - the default test password (from index.php)
3331
DEFAULT_PASSWORD_HASH = '8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92'
3432

35-
3633
# Try common config file locations
3734
config_paths = [
3835
"/data/config/app.conf",
@@ -56,7 +53,7 @@ def get_login_password():
5653

5754
# If it's the default, use the default password
5855
if value == DEFAULT_PASSWORD_HASH:
59-
print(f" Using default password: '123456'")
56+
print(" Using default password: '123456'")
6057
return "123456"
6158
# If it's plaintext and looks reasonable
6259
elif len(value) < 100 and not value.startswith('{') and value.isalnum():
@@ -69,7 +66,7 @@ def get_login_password():
6966
continue
7067

7168
# If we couldn't determine the password from config, try default password
72-
print(f"ℹ Password not determinable from config, trying default passwords...")
69+
print("ℹ Password not determinable from config, trying default passwords...")
7370

7471
# For now, return first test password to try
7572
# Tests will skip if login fails
@@ -203,11 +200,6 @@ def test_login_with_deep_link_to_network_page(driver):
203200
assert '#settings-panel' in current_url, f"Expected #settings-panel hash in URL, got {current_url}"
204201

205202

206-
207-
208-
209-
210-
211203
def test_login_without_next_parameter(driver):
212204
"""Test: Login without ?next parameter defaults to devices.php"""
213205
import pytest

0 commit comments

Comments
 (0)