取消游客模式,强制登录后使用

This commit is contained in:
2026-07-04 09:48:00 +08:00
parent 24630654a2
commit 323f50bfc0
10 changed files with 34 additions and 53 deletions
+2 -2
View File
@@ -20,9 +20,9 @@ type AdminHandler struct {
func allowedRolesForCreation(actor models.RoleName) []models.RoleName {
switch actor {
case models.RoleSystemAdmin:
return []models.RoleName{models.RoleAdmin, models.RoleUser, models.RoleGuest}
return []models.RoleName{models.RoleAdmin, models.RoleUser}
case models.RoleAdmin:
return []models.RoleName{models.RoleUser, models.RoleGuest}
return []models.RoleName{models.RoleUser}
default:
return nil
}
-7
View File
@@ -153,13 +153,6 @@ func (h *AuthHandler) Logout(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"message": "登出成功"})
}
func (h *AuthHandler) PublicInfo(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"message": "欢迎访问 A股工具公开信息",
"guest_allowed": true,
})
}
func hashPassword(password string) (string, error) {
bytes, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
return string(bytes), err