fix: seed_admin() no longer resets admin password on restart

Remove hash verification + password reset logic. seed_admin() now
only creates the admin account if it does not exist. Prevents
password being reset to default + must_change_password flag
being set on every server restart.
This commit is contained in:
2026-07-29 11:28:49 +07:00
parent 33e35a1af1
commit 8775c960e3
2 changed files with 8 additions and 9 deletions
+5
View File
@@ -790,3 +790,8 @@
- **Các file ảnh hưởng:** `app/static/js/app.jsx`
- **Ghi chú/Test (nếu có):** `npm run build` — build passes.
---
### [2026-07-29 11:27] Task: Fix seed_admin() resetting admin password on every restart
- **Tóm tắt thay đổi:** Xóa `else` branch trong `seed_admin()` — từng kiểm tra `if not verify_password(default_pwd, ...)` và reset password admin về `admin123` + `must_change_password=1` mỗi lần server restart nếu password đã bị đổi. Giờ chỉ create admin khi chưa tồn tại.
- **Các file ảnh hưởng:** `app/core/auth.py`
---