Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Instead of using completely arbitrary values for 'nonce' and 'state' in the login.gov URL, let's use a scrambled version of the user's email address.
Security Considerations
There is also a bug fix in users_dao.py. We have changed from using the user's email address as our login.gov key to using the login.gov uuid. This is best practice. However, this leads to an edge case where the user perhaps changes their email in login.gov and we want to change it for them automatically in our app. In the real world, this should work fine. But in local testing, our app got confused which session it was running and this led to a sqlalchemy integrity error, which caused the user (me) to be locked out. So catch that error and log it, but allow the user to proceed.
Again we think right now this session confusion only occurs under abusive local developer testing where they use all their gsa email aliases on the same machine to register with login.gov and our app multiple times, but just in case.