From ec4989a00fe86244c575dec0474fd829258ee0e5 Mon Sep 17 00:00:00 2001 From: Jonathan Hooper Date: Wed, 15 Nov 2023 16:37:46 -0500 Subject: [PATCH] LG-11534 Load the active profile from the session on broken personal key In #9509 we added the ability to specify which profile to fetch PII from when reading PII from the session. This commit uses the active profiles PII when encrypting recovery PII for the active profile when the active profile has a broken personal key. changelog: Internal, Pending and active profile, The active profile PII is fetched with the PII cacher when a user with a broken personal key on their active profile signs in. --- app/controllers/application_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index a22eddd567c..a3ebcfb457f 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -198,7 +198,7 @@ def fix_broken_personal_key_url if pii_unlocked cacher = Pii::Cacher.new(current_user, user_session) profile = current_user.active_profile - user_session[:personal_key] = profile.encrypt_recovery_pii(cacher.fetch) + user_session[:personal_key] = profile.encrypt_recovery_pii(cacher.fetch(profile.id)) profile.save! analytics.broken_personal_key_regenerated