首次登录改密弹窗改为按服务端标记判断,避免旧本地标记误弹

1. 学生端/管理端首次登录弹窗改为调用 /api/auth/me 校验 need_change_password,不再只依赖 localStorage 旧值
2. 学生端首次登录改密已改用 init-passwd(无需原密码)
This commit is contained in:
canglan committed 2026-11-02 12:40:34 +08:00
1 parent db278188c6
commit f624219cba
2 files changed
+27 -6

No files matched your search

+13 -3
View File
@@ -131,9 +131,19 @@ $page_title = $page_title ?? '首页';
</div>
<script>
(function() {
var user = (typeof getUserInfo === 'function') ? getUserInfo() : null;
if (!user || !user.need_change_password) return;
document.getElementById('initPasswordModal').style.display = 'flex';
// 以服务端标记为准判断是否首次登录(避免本地旧标记误弹)
(async function() {
var user = (typeof getUserInfo === 'function') ? getUserInfo() : null;
var need = user && user.need_change_password;
try {
var res = await apiGet('/api/auth/me');
if (res && res.success && res.data) {
need = !!res.data.need_change_password;
}
} catch (e) { /* 接口异常时退回本地标记 */ }
if (!need) return;
document.getElementById('initPasswordModal').style.display = 'flex';
})();
window.submitInitPassword = async function() {
var p1 = document.getElementById('initNewPassword').value;