Beginning adding OTP verification to client shange screen

This commit is contained in:
Lucas Mathews
2024-05-28 17:49:31 +02:00
parent 5d44aef65f
commit 870dd1435f
33 changed files with 72 additions and 29 deletions

View File

@@ -162,9 +162,11 @@ def get_client(client_id:str):
return format_response(False, "Client not found."), 404
@login_required
def update_client(client_id:str, **kwargs):
def update_client(client_id:str, otp_code:int, **kwargs):
"""Updates a client in the database. If the client is not found, returns an error message."""
current_client_id, is_admin = get_current_client()
if not verify_otp(current_client_id, otp_code):
return format_response(False, "Invalid OTP."), 405
if not is_admin and client_id != current_client_id:
return format_response(False, "You can only view your own client information."), 403
for client in session.query(Client).all():