Skip to content

Fix profile phone hydration after encrypted profile updates#267

Merged
datnq2001 merged 1 commit into
masterfrom
fix/profile-phone-hydration
May 12, 2026
Merged

Fix profile phone hydration after encrypted profile updates#267
datnq2001 merged 1 commit into
masterfrom
fix/profile-phone-hydration

Conversation

@datnq2001
Copy link
Copy Markdown
Collaborator

This update fixes the profile phone/address hydration issue after saving user profile changes.

Fixed profile update response flow so the API now re-fetches the canonical profile after update, ensuring contactNumber and address are returned from decrypted profile_encrypted data.
Prevented encrypted raw values from leaking to clients by sanitizing unresolved encrypted payloads (legacy/ciphertext-like strings) to null.
Applied the same sanitization/decryption guard in both profile read and update model paths for consistent behavior.
Files updated

/model/getUserProfile.js
/model/updateUserProfile.js
/services/userProfileService.js
Result

Saving profile now correctly returns hydrated profile fields.
UI no longer receives ciphertext-like phone/address values.
Phone number field remains empty only when data cannot be decrypted with the current backend encryption key.

@datnq2001 datnq2001 merged commit a29c954 into master May 12, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant