Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Allow default admin user login ragflow user of go server (#13715)

Jin Hai04a60a41e0f6
diff --git a/internal/admin/handler.go b/internal/admin/handler.go
index c6d11e4304..7bdf99f633 100644
--- a/internal/admin/handler.go
+++ b/internal/admin/handler.go
@@ -133,7 +133,7 @@ func (h *Handler) Login(c *gin.Context) {
// Use userService.LoginByEmail with adminLogin=true
// This allows default admin account to login admin system
- user, code, err := h.userService.LoginByEmail(&req, true)
+ user, code, err := h.userService.LoginByEmail(&req)
if err != nil {
c.JSON(http.StatusOK, gin.H{
"code": code,
diff --git a/internal/handler/user.go b/internal/handler/user.go
index 651115115d..645683cc28 100644
--- a/internal/handler/user.go
+++ b/internal/handler/user.go
@@ -187,7 +187,7 @@ func (h *UserHandler) LoginByEmail(c *gin.Context) {
return
}
- user, code, err := h.userService.LoginByEmail(&req, false)
+ user, code, err := h.userService.LoginByEmail(&req)
if err != nil {
c.JSON(http.StatusOK, gin.H{
"code": code,
diff --git a/internal/server/config.go b/internal/server/config.go
index 1bc2c9847d..deb4ce10cb 100644
--- a/internal/server/config.go
+++ b/internal/server/config.go
@@ -425,17 +425,17 @@ func FromEnvironments() error {
}
// Storage
- storageType := strings.ToLower(os.Getenv("STORAGE_IMPL"))
- switch storageType {
- case "minio":
- globalConfig.StorageEngine.Type = StorageMinio
- case "s3":
- globalConfig.StorageEngine.Type = StorageS3
- case "oss":
- globalConfig.StorageEngine.Type = StorageOSS
- default:
- return fmt.Errorf("invalid storage type: %s", storageType)
- }
+ //storageType := strings.ToLower(os.Getenv("STORAGE_IMPL"))
+ //switch storageType {
+ //case "minio":
+ // globalConfig.StorageEngine.Type = StorageMinio
+ //case "s3":
+ // globalConfig.StorageEngine.Type = StorageS3
+ //case "oss":
+ // globalConfig.StorageEngine.Type = StorageOSS
+ //default:
+ // return fmt.Errorf("invalid storage type: %s", storageType)
+ //}
// Language
if globalConfig.Language == "" {
diff --git a/internal/service/user.go b/internal/service/user.go
index dbdb3db847..a0a263fa71 100644
--- a/internal/service/user.go
+++ b/internal/service/user.go
@@ -314,11 +314,7 @@ func (s *UserService) Login(req *LoginRequest) (*model.User, common.ErrorCode, e
// - CodeAuthenticationError (109): Email not registered or password mismatch
// - CodeServerError (500): Password decryption failure
// - CodeForbidden (403): Account disabled
-func (s *UserService) LoginByEmail(req *EmailLoginRequest, adminLogin bool) (*model.User, common.ErrorCode, error) {
- if !adminLogin && req.Email == "[email protected]" {
- return nil, common.CodeAuthenticationError, fmt.Errorf("default admin account cannot be used to login normal services")
- }
-
+func (s *UserService) LoginByEmail(req *EmailLoginRequest) (*model.User, common.ErrorCode, error) {
user, err := s.userDAO.GetByEmail(req.Email)
if err != nil {
return nil, common.CodeAuthenticationError, fmt.Errorf("Email: %s is not registered!", req.Email)