Skip to content

Commit

Permalink
Fix minor issue in signin(). Exception type does not have .response attr
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua-Douglas committed Nov 6, 2023
1 parent 5e5fa75 commit 11b278f
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions api/openapi_server/controllers/auth_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from sqlalchemy.exc import IntegrityError
from sqlalchemy import select

from botocore.exceptions import ClientError

cognito_client_url = 'https://homeuniteus.auth.us-east-1.amazoncognito.com'

Expand Down Expand Up @@ -167,13 +168,7 @@ def signUpCoordinator(): # noqa: E501
msg = f"The parameters you provided are incorrect: {error}"
raise AuthError({"message": msg}, 500)



def signin():
# Validate request data
if connexion.request.is_json:
body = connexion.request.get_json()

def signin(body: dict):
secret_hash = current_app.calc_secret_hash(body['email'])

# initiate authentication
Expand All @@ -187,15 +182,8 @@ def signin():
'SECRET_HASH': secret_hash
}
)
except Exception as e:
code = e.response['Error']['Code']
message = e.response['Error']['Message']
status_code = e.response['ResponseMetadata']['HTTPStatusCode']

raise AuthError({
"code": code,
"message": message
}, status_code)
except ClientError as e:
raise AuthError(e.response["Error"], 401)

if(response.get('ChallengeName') and response['ChallengeName'] == 'NEW_PASSWORD_REQUIRED'):
userId = response['ChallengeParameters']['USER_ID_FOR_SRP']
Expand Down

0 comments on commit 11b278f

Please sign in to comment.