From b46bb3e7a432082389334536ad8215e4ca3c9fb9 Mon Sep 17 00:00:00 2001 From: Joe <1264204425@qq.com> Date: Mon, 9 Sep 2024 17:17:18 +0800 Subject: [PATCH] feat: add ALLOW_REGISTER judgement in _generate_account --- api/controllers/console/auth/oauth.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/controllers/console/auth/oauth.py b/api/controllers/console/auth/oauth.py index 7acc05f1da..aba782c181 100644 --- a/api/controllers/console/auth/oauth.py +++ b/api/controllers/console/auth/oauth.py @@ -123,6 +123,8 @@ def _generate_account(provider: str, user_info: OAuthUserInfo): account = _get_account_by_openid_or_email(provider, user_info) if not account: + if not dify_config.ALLOW_REGISTER: + raise Unauthorized("Account not found") account_name = user_info.name if user_info.name else "Dify" account = RegisterService.register( email=user_info.email, name=account_name, password=None, open_id=user_info.id, provider=provider