Skip to content

Commit

Permalink
Merge branch 'feat/new-login' into deploy/dev
Browse files Browse the repository at this point in the history
* feat/new-login:
  feat: add OAuthCallback redirect
  • Loading branch information
ZhouhaoJiang committed Sep 9, 2024
2 parents 943bdfd + 358a5f6 commit 01f180f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions api/controllers/console/auth/oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

from configs import dify_config
from constants.languages import languages
from controllers.console.error import NotAllowedRegister
from extensions.ext_database import db
from libs.helper import get_remote_ip
from libs.oauth import GitHubOAuth, GoogleOAuth, OAuthUserInfo
from models.account import Account, AccountStatus
from services.account_service import AccountService, RegisterService, TenantService
from services.errors.account import AccountNotFound

from .. import api

Expand Down Expand Up @@ -88,7 +88,7 @@ def get(self, provider: str):

try:
account = _generate_account(provider, user_info)
except Unauthorized:
except AccountNotFound:
return redirect(f"{dify_config.CONSOLE_WEB_URL}/signin?message=AccountNotFound")

# Check account status
Expand Down Expand Up @@ -125,7 +125,7 @@ def _generate_account(provider: str, user_info: OAuthUserInfo):

if not account:
if not dify_config.ALLOW_REGISTER:
raise NotAllowedRegister()
raise AccountNotFound()
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
Expand Down

0 comments on commit 01f180f

Please sign in to comment.