diff --git a/backend/apps/system/api/login.py b/backend/apps/system/api/login.py index 426dc4cd..6b07f67a 100644 --- a/backend/apps/system/api/login.py +++ b/backend/apps/system/api/login.py @@ -28,6 +28,8 @@ async def local_login( raise HTTPException(status_code=400, detail=trans('i18n_login.no_associated_ws', msg = trans('i18n_concat_admin'))) if user.status != 1: raise HTTPException(status_code=400, detail=trans('i18n_login.user_disable', msg = trans('i18n_concat_admin'))) + if user.origin is not None and user.origin != 0: + raise HTTPException(status_code=400, detail=trans('i18n_login.origin_error')) access_token_expires = timedelta(minutes=settings.ACCESS_TOKEN_EXPIRE_MINUTES) user_dict = user.to_dict() return Token(access_token=create_access_token( diff --git a/backend/apps/system/schemas/system_schema.py b/backend/apps/system/schemas/system_schema.py index f16f6dd3..60247c3c 100644 --- a/backend/apps/system/schemas/system_schema.py +++ b/backend/apps/system/schemas/system_schema.py @@ -34,6 +34,7 @@ class BaseUserDTO(BaseUser, BaseCreatorDTO): language: str = Field(pattern=r"^(zh-CN|en|ko-KR)$", default="zh-CN", description="用户语言") password: str status: int = 1 + origin: int = 0 def to_dict(self): return { diff --git a/backend/locales/en.json b/backend/locales/en.json index 87d9cad3..25c40f49 100644 --- a/backend/locales/en.json +++ b/backend/locales/en.json @@ -11,7 +11,8 @@ "i18n_login": { "account_pwd_error": "Incorrect account or password!", "no_associated_ws": "No associated workspace, {msg}", - "user_disable": "Account is disabled, {msg}" + "user_disable": "Account is disabled, {msg}", + "origin_error": "Invalid login method" }, "i18n_user": { "account": "Account", diff --git a/backend/locales/ko-KR.json b/backend/locales/ko-KR.json index d1928caf..e90b078d 100644 --- a/backend/locales/ko-KR.json +++ b/backend/locales/ko-KR.json @@ -11,7 +11,8 @@ "i18n_login": { "account_pwd_error": "계정 또는 비밀번호가 잘못되었습니다!", "no_associated_ws": "연결된 작업 공간이 없습니다, {msg}", - "user_disable": "계정이 비활성화되었습니다, {msg}" + "user_disable": "계정이 비활성화되었습니다, {msg}", + "origin_error": "잘못된 로그인 방식입니다" }, "i18n_user": { "account": "계정", diff --git a/backend/locales/zh-CN.json b/backend/locales/zh-CN.json index 06526977..e5fd31df 100644 --- a/backend/locales/zh-CN.json +++ b/backend/locales/zh-CN.json @@ -11,7 +11,8 @@ "i18n_login": { "account_pwd_error": "账号或密码错误!", "no_associated_ws": "没有关联的工作空间,{msg}", - "user_disable": "账号已禁用,{msg}" + "user_disable": "账号已禁用,{msg}", + "origin_error": "登录方式错误" }, "i18n_user": { "account": "账号",