From e50fe082674ae84efcc9e02f24fe34e383c9fa4f Mon Sep 17 00:00:00 2001 From: Thomas Schmid Date: Wed, 10 Jan 2024 22:59:42 +0100 Subject: [PATCH] WebApp: Api: "status" command without credentials This allows the "status" command to be executed without credentials. Signed-off-by: Thomas Schmid --- pydoorlock/WebApp.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pydoorlock/WebApp.py b/pydoorlock/WebApp.py index ad10a28..0a7cfe1 100644 --- a/pydoorlock/WebApp.py +++ b/pydoorlock/WebApp.py @@ -120,6 +120,9 @@ def api(): password = request.form.get('pass') command = request.form.get('command') + if (command is not None) and (command == 'status'): + return json_response(DoorlockResponse.Success) + if any(v is None for v in [user, password, command]): log.warning('Incomplete API request') abort(400) @@ -131,9 +134,6 @@ def api(): credentials = user, password - if command == 'status': - return json_response(logic.auth.try_auth(credentials)) - desired_state = DoorState.from_string(command) if not desired_state: return json_response(DoorlockResponse.Inval, "Invalid command requested")