Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: remove email code login redirect (#9698)

Joeed96a6b6c008
diff --git a/api/controllers/console/auth/login.py b/api/controllers/console/auth/login.py
index 4821c543b7b..6c795f95b63 100644
--- a/api/controllers/console/auth/login.py
+++ b/api/controllers/console/auth/login.py
@@ -1,11 +1,10 @@
from typing import cast
import flask_login
-from flask import redirect, request
+from flask import request
from flask_restful import Resource, reqparse
import services
-from configs import dify_config
from constants.languages import languages
from controllers.console import api
from controllers.console.auth.error import (
@@ -196,10 +195,7 @@ class EmailCodeLoginApi(Resource):
email=user_email, name=user_email, interface_language=languages[0]
)
except WorkSpaceNotAllowedCreateError:
- return redirect(
- f"{dify_config.CONSOLE_WEB_URL}/signin"
- "?message=Workspace not found, please contact system admin to invite you to join in a workspace."
- )
+ return NotAllowedCreateWorkspace()
token_pair = AccountService.login(account, ip_address=extract_remote_ip(request))
AccountService.reset_login_error_rate_limit(args["email"])
return {"result": "success", "data": token_pair.model_dump()}
diff --git a/api/controllers/console/error.py b/api/controllers/console/error.py
index a6d4c8e8ec3..ed6a99a017f 100644
--- a/api/controllers/console/error.py
+++ b/api/controllers/console/error.py
@@ -41,7 +41,7 @@ class AlreadyActivateError(BaseHTTPException):
class NotAllowedCreateWorkspace(BaseHTTPException):
- error_code = "unauthorized"
+ error_code = "not_allowed_create_workspace"
description = "Workspace not found, please contact system admin to invite you to join in a workspace."
code = 400