Merge branch 'feat/new-login' into test/new-login-testing
Some checks are pending
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/amd64, build-api-amd64) (push) Waiting to run
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/arm64, build-api-arm64) (push) Waiting to run
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/amd64, build-web-amd64) (push) Waiting to run
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/arm64, build-web-arm64) (push) Waiting to run
Build and Push API & Web / create-manifest (api, DIFY_API_IMAGE_NAME, merge-api-images) (push) Blocked by required conditions
Build and Push API & Web / create-manifest (web, DIFY_WEB_IMAGE_NAME, merge-web-images) (push) Blocked by required conditions

* feat/new-login:
  feat: update account not found
This commit is contained in:
Joe 2024-10-18 18:01:53 +08:00
commit b53c72b375
3 changed files with 6 additions and 5 deletions

View File

@ -46,6 +46,7 @@ class ForgotPasswordSendEmailApi(Resource):
if account is None:
if FeatureService.system_features.is_allow_register:
token = AccountService.send_reset_password_email(email=args["email"], language=language)
return {"result": "fail", "data": token, "code": "account_not_found"}
else:
raise NotAllowedRegister()
else:

View File

@ -73,11 +73,11 @@ class LoginApi(Resource):
AccountService.add_login_error_rate_limit(args["email"])
raise EmailOrPasswordMismatchError()
except services.errors.account.AccountNotFoundError:
if not FeatureService.system_features.is_allow_register:
if FeatureService.system_features.is_allow_register:
token = AccountService.send_reset_password_email(email=args["email"], language=language)
return {"result": "fail", "data": token, "code": "account_not_found"}
else:
raise NotAllowedRegister()
token = AccountService.send_reset_password_email(email=args["email"], language=language)
return {"result": "fail", "data": token, "message": "account_not_found"}
# SELF_HOSTED only have one workspace
tenants = TenantService.get_join_tenants(account)
if len(tenants) == 0:

View File

@ -54,7 +54,7 @@ class AccountBannedOrClosedError(BaseHTTPException):
class NotAllowedRegister(BaseHTTPException):
error_code = "unauthorized"
description = "account_not_found"
description = "Account not found."
code = 400