diff --git a/app/api/views/sudo.py b/app/api/views/sudo.py index 04806f823afc9cc9c273b0371d800cf463b77203..a6bb6e337dcc58a562e314d5b34a97213e15b016 100644 --- a/app/api/views/sudo.py +++ b/app/api/views/sudo.py @@ -17,9 +17,9 @@ def enter_sudo(): user = g.user data = request.get_json() or {} if "password" not in data: - return jsonify(error="Invalid request"), 403 + return jsonify(error="Invalid password"), 403 if not user.check_password(data["password"]): - return jsonify(error="Invalid request"), 403 + return jsonify(error="Invalid password"), 403 g.api_key.sudo_mode_at = arrow.now() Session.commit() diff --git a/docs/api.md b/docs/api.md index 79a5fc33f6f9a3d8908bc6075c7b363a02f29df0..a12fbd608f2e17807d2483b1c77c668e9589a221 100644 --- a/docs/api.md +++ b/docs/api.md @@ -229,11 +229,19 @@ Enable sudo mode Input: +- `Authentication` header that contains the api key - password: User password to validate the user presence and enter sudo mode +```json +{ + "password": "yourpassword", +} +``` + Output: -- ok: True if sudo mode has been enabled +- 200 with ```{"ok": true}``` if sudo mode has been enabled. +- 403 with ```{"error": "Some error"} ``` if there's an error #### POST /api/api_key