mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-02 05:47:31 +08:00
@@ -1347,7 +1347,7 @@ func (h *DocumentHandler) Ingest(c *gin.Context) {
|
||||
|
||||
userID := strings.TrimSpace(user.ID)
|
||||
if userID == "" {
|
||||
common.ResponseWithCodeData(c, common.CodeAuthenticationError, nil, "No Authentication")
|
||||
common.ResponseWithCodeData(c, common.CodeAuthenticationError, nil, "no authentication")
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -451,7 +451,7 @@ func (h *UserHandler) ChangePassword(c *gin.Context) {
|
||||
// @Tags users
|
||||
// @Success 200 {object} map[string]interface{}
|
||||
// @Router /v1/user/login/channels [get]
|
||||
func (h *UserHandler) GetLoginChannels(c *gin.Context) {
|
||||
func (h *UserHandler) GetLoginChannelsDeprecated(c *gin.Context) {
|
||||
channels, code, err := h.userService.GetLoginChannels()
|
||||
if err != nil {
|
||||
common.ResponseWithCodeData(c, code, []interface{}{}, "Load channels failure, error: "+err.Error())
|
||||
|
||||
@@ -52,7 +52,7 @@ const oauthAuthCookie = "ragflow_auth"
|
||||
// @Tags users
|
||||
// @Param channel path string true "channel name"
|
||||
// @Router /api/v1/auth/login/{channel} [get]
|
||||
func (h *UserHandler) OAuthLogin(c *gin.Context) {
|
||||
func (h *UserHandler) OAuthLoginDeprecated(c *gin.Context) {
|
||||
channel := c.Param("channel")
|
||||
if channel == "" {
|
||||
common.ResponseWithHttpCodeData(c, http.StatusBadRequest, common.CodeArgumentError, nil, "channel is required")
|
||||
@@ -89,7 +89,7 @@ func (h *UserHandler) OAuthLogin(c *gin.Context) {
|
||||
// @Param code query string true "authorization code"
|
||||
// @Param state query string true "state token"
|
||||
// @Router /api/v1/auth/oauth/{channel}/callback [get]
|
||||
func (h *UserHandler) OAuthChannelCallback(c *gin.Context) {
|
||||
func (h *UserHandler) OAuthChannelCallbackDeprecated(c *gin.Context) {
|
||||
channel := c.Param("channel")
|
||||
// An empty channel segment (/auth/oauth//callback) is a malformed path,
|
||||
// not a real channel. Python's router never matches it and returns 404;
|
||||
|
||||
@@ -65,3 +65,15 @@ func (h *UserHandler) IsAdmin(c *gin.Context) {
|
||||
func (h *UserHandler) GetMeta(c *gin.Context) {
|
||||
common.ErrorWithCode(c, common.CodeNotImplemented, "GetMeta not implemented")
|
||||
}
|
||||
|
||||
func (h *UserHandler) OAuthLogin(c *gin.Context) {
|
||||
common.ErrorWithCode(c, common.CodeNotImplemented, "OAuthLogin not implemented")
|
||||
}
|
||||
|
||||
func (h *UserHandler) OAuthChannelCallback(c *gin.Context) {
|
||||
common.ErrorWithCode(c, common.CodeNotImplemented, "OAuthChannelCallback not implemented")
|
||||
}
|
||||
|
||||
func (h *UserHandler) GetLoginChannels(c *gin.Context) {
|
||||
common.SuccessWithData(c, []interface{}{}, "success")
|
||||
}
|
||||
|
||||
@@ -175,19 +175,9 @@ func (r *Router) Setup(engine *gin.Engine) {
|
||||
// searchbots
|
||||
apiNoAuth.GET("/searchbots/detail", r.searchBotHandler.SearchBotDetail)
|
||||
|
||||
// User login channels endpoint
|
||||
apiNoAuth.GET("/auth/login/channels", r.userHandler.GetLoginChannels)
|
||||
|
||||
// User login by email endpoint
|
||||
apiNoAuth.POST("/auth/login", r.userHandler.LoginByEmail)
|
||||
|
||||
// OAuth / OIDC login routes. The static "channels" segment is
|
||||
// registered before the wildcard, so gin's tree resolves
|
||||
// /auth/login/channels to GetLoginChannels and other values to
|
||||
// OAuthLogin without conflict.
|
||||
apiNoAuth.GET("/auth/login/:channel", r.userHandler.OAuthLogin)
|
||||
apiNoAuth.GET("/auth/oauth/:channel/callback", r.userHandler.OAuthChannelCallback)
|
||||
|
||||
// Register
|
||||
apiNoAuth.POST("/users", r.userHandler.Register)
|
||||
|
||||
|
||||
@@ -25,6 +25,9 @@ func SetupEERouter(engine *gin.Engine) {
|
||||
|
||||
func RegisterEENoAuthRouter(apiNoAuth *gin.RouterGroup, r *Router) {
|
||||
// For EE
|
||||
apiNoAuth.GET("/auth/login/channels", r.userHandler.GetLoginChannels)
|
||||
apiNoAuth.GET("/auth/login/:channel", r.userHandler.OAuthLogin)
|
||||
apiNoAuth.GET("/auth/oauth/:channel/callback", r.userHandler.OAuthChannelCallback)
|
||||
apiNoAuth.GET("/auth/oauth/callback", r.userHandler.OAuthCallback)
|
||||
apiNoAuth.GET("/auth/oauth/github/callback", r.userHandler.GitHubAuthCallback)
|
||||
apiNoAuth.GET("/auth/oauth/lark/callback", r.userHandler.LarkAuthCallback)
|
||||
|
||||
Reference in New Issue
Block a user