mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-08 08:28:02 +08:00
@@ -98,6 +98,7 @@ func (h *UserHandler) Register(c *gin.Context) {
|
||||
}
|
||||
|
||||
c.Header("Authorization", authToken)
|
||||
setOAuthAuthCookie(c, authToken)
|
||||
c.Header("Access-Control-Allow-Origin", "*")
|
||||
c.Header("Access-Control-Allow-Methods", "*")
|
||||
c.Header("Access-Control-Allow-Headers", "*")
|
||||
@@ -163,6 +164,7 @@ func (h *UserHandler) Login(c *gin.Context) {
|
||||
|
||||
// Set Authorization header with signed token
|
||||
c.Header("Authorization", authToken)
|
||||
setOAuthAuthCookie(c, authToken)
|
||||
// Set CORS headers
|
||||
c.Header("Access-Control-Allow-Origin", "*")
|
||||
c.Header("Access-Control-Allow-Methods", "*")
|
||||
@@ -235,7 +237,7 @@ func (h *UserHandler) LoginByEmail(c *gin.Context) {
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
setOAuthAuthCookie(c, authToken)
|
||||
c.Header("Authorization", authToken)
|
||||
c.Header("Access-Control-Allow-Origin", "*")
|
||||
c.Header("Access-Control-Allow-Methods", "*")
|
||||
@@ -341,6 +343,16 @@ func (h *UserHandler) ListUsers(c *gin.Context) {
|
||||
// @Success 200 {object} map[string]interface{}
|
||||
// @Router /v1/user/logout [post]
|
||||
func (h *UserHandler) Logout(c *gin.Context) {
|
||||
http.SetCookie(c.Writer, &http.Cookie{
|
||||
Name: oauthAuthCookie,
|
||||
Value: "",
|
||||
Path: "/",
|
||||
MaxAge: -1,
|
||||
HttpOnly: false,
|
||||
SameSite: http.SameSiteLaxMode,
|
||||
Secure: c.Request.TLS != nil,
|
||||
})
|
||||
|
||||
// Same as AuthMiddleware@auth.go
|
||||
token := c.GetHeader("Authorization")
|
||||
if token == "" {
|
||||
|
||||
Reference in New Issue
Block a user