mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 01:06:59 +08:00
perf: Users from third-party platforms are prohibited from using the default login
This commit is contained in:
committed by
fit2cloud-chenyw
parent
22488295ff
commit
b9f47ddea9
@@ -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(
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
"i18n_login": {
|
||||
"account_pwd_error": "계정 또는 비밀번호가 잘못되었습니다!",
|
||||
"no_associated_ws": "연결된 작업 공간이 없습니다, {msg}",
|
||||
"user_disable": "계정이 비활성화되었습니다, {msg}"
|
||||
"user_disable": "계정이 비활성화되었습니다, {msg}",
|
||||
"origin_error": "잘못된 로그인 방식입니다"
|
||||
},
|
||||
"i18n_user": {
|
||||
"account": "계정",
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
"i18n_login": {
|
||||
"account_pwd_error": "账号或密码错误!",
|
||||
"no_associated_ws": "没有关联的工作空间,{msg}",
|
||||
"user_disable": "账号已禁用,{msg}"
|
||||
"user_disable": "账号已禁用,{msg}",
|
||||
"origin_error": "登录方式错误"
|
||||
},
|
||||
"i18n_user": {
|
||||
"account": "账号",
|
||||
|
||||
Reference in New Issue
Block a user