Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions backend/apps/system/api/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions backend/apps/system/schemas/system_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion backend/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion backend/locales/ko-KR.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"i18n_login": {
"account_pwd_error": "계정 또는 비밀번호가 잘못되었습니다!",
"no_associated_ws": "연결된 작업 공간이 없습니다, {msg}",
"user_disable": "계정이 비활성화되었습니다, {msg}"
"user_disable": "계정이 비활성화되었습니다, {msg}",
"origin_error": "잘못된 로그인 방식입니다"
},
"i18n_user": {
"account": "계정",
Expand Down
3 changes: 2 additions & 1 deletion backend/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"i18n_login": {
"account_pwd_error": "账号或密码错误!",
"no_associated_ws": "没有关联的工作空间,{msg}",
"user_disable": "账号已禁用,{msg}"
"user_disable": "账号已禁用,{msg}",
"origin_error": "登录方式错误"
},
"i18n_user": {
"account": "账号",
Expand Down