mirror of
https://github.com/open-webui/open-webui
synced 2025-05-22 05:53:20 +00:00
refac
This commit is contained in:
parent
1ae702b8a6
commit
fcbdfbd744
@ -194,7 +194,7 @@ class AuditLoggingMiddleware:
|
|||||||
|
|
||||||
auth_header = request.headers.get("Authorization")
|
auth_header = request.headers.get("Authorization")
|
||||||
assert auth_header
|
assert auth_header
|
||||||
user = get_current_user(request, get_http_authorization_cred(auth_header))
|
user = get_current_user(request, None, get_http_authorization_cred(auth_header))
|
||||||
|
|
||||||
return user
|
return user
|
||||||
|
|
||||||
|
@ -205,7 +205,8 @@ def get_current_user(
|
|||||||
else:
|
else:
|
||||||
# Refresh the user's last active timestamp asynchronously
|
# Refresh the user's last active timestamp asynchronously
|
||||||
# to prevent blocking the request
|
# to prevent blocking the request
|
||||||
background_tasks.add_task(Users.update_user_last_active_by_id, user.id)
|
if background_tasks:
|
||||||
|
background_tasks.add_task(Users.update_user_last_active_by_id, user.id)
|
||||||
return user
|
return user
|
||||||
else:
|
else:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
|
Loading…
Reference in New Issue
Block a user