DEBUG Admin

This commit is contained in:
2023-07-07 09:17:25 +08:00
parent 581da1b294
commit cfe3fbc4d4

View File

@@ -37,7 +37,7 @@ func AccountRead(w http.ResponseWriter, r *http.Request, cb func(account *Accoun
// 獲取當前用戶
user := User{ID: session.UserID}
if err := configs.ORMDB().Model(&user).Select("id, name, email, created_at, updated_at").Find(&user).Error; err != nil {
if err := configs.ORMDB().Take(&user).Error; err != nil {
http.SetCookie(w, &http.Cookie{Name: "session_id", Value: "", Path: "/", MaxAge: -1})
w.WriteHeader(http.StatusUnauthorized)
w.Write([]byte("401 - 用戶不存在, 請重新登錄"))