mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-11 22:25:41 +08:00
PY: fix admin error (#16827)
### Summary Sync code from EE Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
@@ -8,7 +8,7 @@ readme = "README.md"
|
||||
requires-python = ">=3.13,<3.14"
|
||||
dependencies = [
|
||||
"requests>=2.30.0,<3.0.0",
|
||||
"beartype>=0.20.0,<1.0.0",
|
||||
"beartype>=0.22.9,<1.0.0",
|
||||
"pycryptodomex>=3.10.0",
|
||||
"lark>=1.1.0",
|
||||
"requests-toolbelt>=1.0.0",
|
||||
|
||||
@@ -152,13 +152,13 @@ def check_admin_auth(func):
|
||||
def login_admin(email: str, password: str):
|
||||
"""
|
||||
:param email: admin email
|
||||
:param password: string before decrypt
|
||||
:param password: string before decrypt (RSA encrypted + base64 encoded)
|
||||
"""
|
||||
users = UserService.query(email=email)
|
||||
if not users:
|
||||
raise UserNotFoundError(email)
|
||||
psw = decrypt(password)
|
||||
user = UserService.query_user(email, psw)
|
||||
decrypted = decrypt(password)
|
||||
user = UserService.query_user(email, decrypted)
|
||||
if not user:
|
||||
raise AdminException("Email and password do not match!")
|
||||
if not user.is_superuser:
|
||||
|
||||
@@ -153,6 +153,8 @@ def change_password(username):
|
||||
def alter_user_activate_status(username):
|
||||
try:
|
||||
data = request.get_json()
|
||||
if current_user.email == username:
|
||||
return error_response(f"can't alter current user status: {username}", 409)
|
||||
if not data or "activate_status" not in data:
|
||||
return error_response("Activation status is required", 400)
|
||||
activate_status = data["activate_status"]
|
||||
|
||||
Reference in New Issue
Block a user