From 326523ebfc747eaff1c5a9f601fefb9080a5e0c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20P=C3=A9chard?= Date: Thu, 5 Nov 2015 13:48:25 +0100 Subject: [PATCH] Conform to current API v2 Add a test to conform API v2 and its erroneous status. Should be rewritten for v3. --- photobackup_bottle/photobackup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/photobackup_bottle/photobackup.py b/photobackup_bottle/photobackup.py index 3d2dd70..ac9d9e0 100755 --- a/photobackup_bottle/photobackup.py +++ b/photobackup_bottle/photobackup.py @@ -74,7 +74,7 @@ def end(code, message): abort(code, message) -def validate_password(request): +def validate_password(request, isTest = False): password = request.forms.get('password').encode('utf-8') if 'PasswordBcrypt' in config: @@ -83,7 +83,7 @@ def validate_password(request): end(403, "wrong password!") elif 'Password' in config and config['Password'] != password: end(403, "wrong password!") - else: + elif isTest: end(401, "There's no password in server configuration!") @@ -133,7 +133,7 @@ def save_image(): @route('/test', method='POST') def test(): - validate_password(request) + validate_password(request, True) if not os.path.exists(config['MediaRoot']): end(500, "'MediaRoot' directory does not exist!")