mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-15 20:27:20 +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:
@@ -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