From 7a13dabbedff1184c12e3e4f5cf56545f1d01397 Mon Sep 17 00:00:00 2001 From: Kanagaraj Manickam Date: Tue, 20 Oct 2020 07:34:42 +0530 Subject: Fix the format issues Issue-ID: DOVETAIL-801 Signed-off-by: Kanagaraj Manickam Change-Id: Id0058788d8d2d8fb8a1fa0a7c43fc3c1731d73df --- opnfv_testapi/ui/auth/sign.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'opnfv_testapi/ui') diff --git a/opnfv_testapi/ui/auth/sign.py b/opnfv_testapi/ui/auth/sign.py index 80f7e33..42f292e 100644 --- a/opnfv_testapi/ui/auth/sign.py +++ b/opnfv_testapi/ui/auth/sign.py @@ -309,12 +309,15 @@ class LoginHandler(base.BaseHandler): "form_id": form_id, } headers = {'Content-Type': 'application/x-www-form-urlencoded'} - response = requests.post('https://identity.linuxfoundation.org', - data=params, headers=headers) + response = requests.post( + 'https://identity.linuxfoundation.org', + data=params, + headers=headers + ) response_text = response.content if "unrecognized username or password" in response_text: raises.Unauthorized(message.invalid_credentials()) - #generate random token and store in memcache + # generate random token and store in memcache token = base.get_token() resp = {'status': 'success'} mc = memcache.Client(['127.0.0.1:11211'], debug=0) @@ -322,12 +325,13 @@ class LoginHandler(base.BaseHandler): self.set_header("token", token) self.finish_request(resp) + class LogoutHandler(base.BaseHandler): def post(self): input_token = self.request.headers._dict['Token'] mc = memcache.Client(['127.0.0.1:11211'], debug=0) token = mc.get("token") - if not token or not input_token == token : + if not token or not input_token == token: raises.Unauthorized(message.invalid_token()) mc.set("token", '') resp = {'Message': 'You have been logged out successfully.'} -- cgit 1.2.3-korg