From: Kanagaraj Manickam Date: Fri, 25 Sep 2020 10:15:30 +0000 (+0530) Subject: Added Validation for Invalid Credentilas X-Git-Tag: opnfv-10.0.0~22 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F73%2F71273%2F4;p=dovetail-webportal.git Added Validation for Invalid Credentilas Issue-ID: DOVETAIL-801 Signed-off-by: Kanagaraj Manickam Change-Id: I35b35773847ecc9175ca634cb9ae1a341c9c2eeb --- diff --git a/opnfv_testapi/ui/auth/sign.py b/opnfv_testapi/ui/auth/sign.py index 29be209..6a9092a 100644 --- a/opnfv_testapi/ui/auth/sign.py +++ b/opnfv_testapi/ui/auth/sign.py @@ -311,5 +311,8 @@ class LoginHandler(base.BaseHandler): headers = {'Content-Type': 'application/x-www-form-urlencoded'} 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()) resp = {'status': 'success'} self.finish_request(resp)