feat: 管理端用户列表显示姓名和公司

This commit is contained in:
Nixevol
2026-11-18 11:53:05 +08:00
parent 032c5280e7
commit 199960276a
8 changed files with 86 additions and 1 deletions
+4
View File
@@ -498,6 +498,8 @@ def test_check_skips_empty_credential_and_updates_saved_one(monkeypatch) -> None
saved = next(item for item in body if item["employee_id"] == "saved-user")
assert set(saved) == {
"employee_id",
"user_name",
"company",
"has_credential",
"refresh_paused",
"last_refresh_at",
@@ -524,6 +526,8 @@ def test_check_skips_empty_credential_and_updates_saved_one(monkeypatch) -> None
assert saved["refresh_paused"] is False
assert saved["credential_valid"] is True
assert saved["month_hours"] == ""
assert saved["user_name"] == ""
assert saved["company"] == ""
assert isinstance(saved["last_refresh_at"], str)
calls.clear()
again = client.get("/api/admin/users")
+14
View File
@@ -150,6 +150,8 @@ def test_login_stores_password_and_credential_only(monkeypatch) -> None:
"last_refresh_at",
"credential_valid",
"month_hours",
"user_name",
"company",
"hours_month",
"monthly_target",
"proxy_scheme",
@@ -185,6 +187,18 @@ def test_login_stores_password_and_credential_only(monkeypatch) -> None:
assert updated["yxt_token"] == "yxt-2"
assert "测试用户" not in decrypt_secret(account.credential_cipher)
assert "测试用户" not in decrypt_secret(account.password_cipher)
assert account.user_name == "测试用户"
assert account.company == "测试部门"
from euniv.service import _remember_profile
_remember_profile(db, "6650000146", {"name": " ", "department": "", "level": "Scientist"})
db.refresh(account)
assert account.user_name == "测试用户"
assert account.company == "测试部门"
_remember_profile(db, "6650000146", {"name": "新名字", "department": "广州瀚信广州处", "level": "Scientist"})
db.refresh(account)
assert account.user_name == "新名字"
assert account.company == "广州瀚信广州处"
def test_qr_mark_cannot_password_login_and_unicode_password_is_safe(monkeypatch) -> None: