feat: opaque session、安装/发帖 SSR 与最小 Admin 后台

浏览器登录改为 DB sessions(可吊销);敏感词与 OIDC PEM 入 settings;
落地安装向导、注册发帖与 /admin 仪表盘/板块/审核/设置。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-29 05:44:16 +08:00
parent 3f50316ad0
commit fde5f628ec
80 changed files with 4148 additions and 1849 deletions

View File

@@ -95,7 +95,11 @@ func (s *UserService) ResetPasswordByEmail(email, newPass string) error {
if err != nil {
return err
}
return models.DB.Model(&models.User{}).Where("id = ?", user.ID).Update("password", hash).Error
if err := models.DB.Model(&models.User{}).Where("id = ?", user.ID).Update("password", hash).Error; err != nil {
return err
}
RevokeUserSessions(user.ID)
return nil
}
// SearchUsersBrief 公开用户搜索(@补全):匹配用户名/昵称,不含邮箱
@@ -288,7 +292,13 @@ func (s *UserService) BanUser(userID uint, banned bool) error {
if banned {
updates["banned_at"] = &now
}
return models.DB.Model(&models.User{}).Where("id = ?", userID).Updates(updates).Error
if err := models.DB.Model(&models.User{}).Where("id = ?", userID).Updates(updates).Error; err != nil {
return err
}
if banned {
RevokeUserSessions(userID)
}
return nil
}
// SitemapUser 站点地图用的轻量用户字段