Fix Broken Personal Keys (LG-5525)#6010
Conversation
| def fix_broken_personal_key_url | ||
| if current_user.broken_personal_key? | ||
| pii_unlocked = user_session[:decrypted_pii].present? | ||
|
|
||
| if pii_unlocked | ||
| cacher = Pii::Cacher.new(current_user, user_session) | ||
| user_session[:personal_key] = current_user.active_profile.encrypt_recovery_pii(cacher.fetch) | ||
|
|
||
| flash[:info] = t('account.personal_key.needs_new') | ||
| analytics.track_event(Analytics::BROKEN_PERSONAL_KEY_REGENERATED) | ||
|
|
||
| manage_personal_key_url | ||
| else | ||
| flash[:info] = t('account.personal_key.needs_new_password_prompt') | ||
| user_session[:needs_new_personal_key] = true | ||
|
|
||
| capture_password_url | ||
| end | ||
| end | ||
| end |
There was a problem hiding this comment.
I'm not in love with a plain "_url" method having a ton of side effects, especially in such a hot path... but I wasn't sure if we had better places to insert something into the "flow" after signing in but before getting redirected elsewhere
changelog: Bug Fixes, Account Recovery, Add flow to help accounts replace personal keys
aduth
left a comment
There was a problem hiding this comment.
I ran through the flow locally, but when testing the password reset flow, reactivating the profile with the new key produced an "Incorrect personal key" error for me.
Co-authored-by: Andrew Duthie <andrew.duthie@gsa.gov>
Which order did you go through the password reset flow? The problem with resetting the password, is that for these broken personal keys, the password is the only viable way to decrypt the user's data, because the old personal key is broken. So resetting the password means that we're ophaning the data... probably need to have additional warning screens or link directly to the re-verify flow |
|
Did you reset password from the account page? Or from a signed out page? |
Signed out. Sorry, missed that in steps. Updated them. |
Co-authored-by: Andrew Duthie <aduth@users.noreply.github.com>
Between #5230 and #5433, users who went through the IDV flow received broken personal keys.
This PR introduces a flow that gives these users a new personal key, so they can successfully recover their data if they forget their password.
To test this out locally or in a sandbox environment, update the user like this and then log in anywhere