Skip to content

Commit

Permalink
pe_connect: Add message to users
Browse files Browse the repository at this point in the history
Without it, they don't understand what is happening.
  • Loading branch information
tonial committed Jan 7, 2025
1 parent bab08d9 commit b5a79dd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions itou/openid_connect/pe_connect/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,19 +109,19 @@ def pe_connect_callback(request):
)
if response.status_code != 200:
error_msg = "Impossible d'obtenir les informations utilisateur de PôleEmploiConnect."
return _redirect_to_job_seeker_login_on_error(error_msg)
return _redirect_to_job_seeker_login_on_error(error_msg, request)

try:
user_data = json.loads(response.content.decode("utf-8"))
except json.decoder.JSONDecodeError:
error_msg = "Impossible de décoder les informations utilisateur."
return _redirect_to_job_seeker_login_on_error(error_msg)
return _redirect_to_job_seeker_login_on_error(error_msg, request)

if "sub" not in user_data:
# 'sub' is the unique identifier from PôleEmploiConnect, we need that to match a user later on
error_msg = "Le paramètre « sub » n'a pas été retourné par PôleEmploiConnect. Il est nécessaire pour identifier un utilisateur." # noqa E501
logger.error(error_msg, exc_info=True)
return _redirect_to_job_seeker_login_on_error(error_msg)
return _redirect_to_job_seeker_login_on_error(error_msg, request)

try:
pe_user_data = PoleEmploiConnectUserData.from_user_info(user_data)
Expand Down

0 comments on commit b5a79dd

Please sign in to comment.