gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-bank] 04/04: simplifying errors handling when authen


From: gnunet
Subject: [GNUnet-SVN] [taler-bank] 04/04: simplifying errors handling when authenticating
Date: Sun, 07 May 2017 13:08:45 +0200

This is an automated email from the git hooks/post-receive script.

marcello pushed a commit to branch master
in repository bank.

commit 4e687bb9024a17c5422a62628ac1a940fa14168e
Author: Marcello Stanisci <address@hidden>
AuthorDate: Sun May 7 12:52:42 2017 +0200

    simplifying errors handling when authenticating
---
 talerbank/app/tests.py | 2 +-
 talerbank/app/views.py | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/talerbank/app/tests.py b/talerbank/app/tests.py
index 738d469..7d3c057 100644
--- a/talerbank/app/tests.py
+++ b/talerbank/app/tests.py
@@ -154,7 +154,7 @@ class HistoryTestCase(TestCase):
         self.assertEqual(403, response.status_code)
 
         # Query about non-existent account
-        response = c.get(reverse("history", urlconf=urls), {"auth": "basic", 
"delta": "+1", "account_number": 9},
+        response = c.get(reverse("history", urlconf=urls), {"auth": "basic", 
"delta": "-1", "account_number": 9},
                          **{"HTTP_X_TALER_BANK_USERNAME": "User", 
"HTTP_X_TALER_BANK_PASSWORD": "Password"})
         self.assertEqual(404, response.status_code)
 
diff --git a/talerbank/app/views.py b/talerbank/app/views.py
index 98cf6d3..68c1946 100644
--- a/talerbank/app/views.py
+++ b/talerbank/app/views.py
@@ -331,7 +331,7 @@ def history(request):
     # login caller
     user_account = auth_and_login(request)
     if not user_account:
-        return JsonResponse(dict(error="authentication failed"),
+        return JsonResponse(dict(error="authentication failed: bad credentials 
OR auth method"),
                             status=401)
     # delta
     delta = request.GET.get("delta")
@@ -419,8 +419,8 @@ def auth_and_login(request):
         auth_type = request.GET.get("auth")
 
     if "basic" != auth_type:
-        return JsonResponse(dict(error="auth method not supported"),
-                            status=405)        
+        logger.error("auth method not supported")
+        return False
 
     username = request.META.get("HTTP_X_TALER_BANK_USERNAME")
     password = request.META.get("HTTP_X_TALER_BANK_PASSWORD")

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]