[PR #5833] fix(phone-number): shouldn't allow updating phone number on /update-user endpoint #14507

Closed
opened 2026-04-13 09:30:42 -05:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/better-auth/better-auth/pull/5833

State: closed
Merged: Yes


Right now you can call authClient.updateUser({phoneNumber: "123"}) and if the user previously had an older phone number verified, the phoneNumberVerified state stays true, despite updating to an unverified phone number.

This PR fixes this and introduces tests.


Summary by cubic

Prevents updating a user's phone number via updateUser. Requests now return 400 and keep phoneNumber and phoneNumberVerified unchanged.

  • Bug Fixes
    • Block phoneNumber updates on /update-user via a before hook; returns "Phone number cannot be updated".
    • Added tests to ensure the phone number can't be changed and verification state remains intact.

Written for commit 50a41e4309. Summary will update automatically on new commits.

**Original Pull Request:** https://github.com/better-auth/better-auth/pull/5833 **State:** closed **Merged:** Yes --- Right now you can call `authClient.updateUser({phoneNumber: "123"})` and if the user previously had an older phone number verified, the `phoneNumberVerified` state stays `true`, despite updating to an unverified phone number. This PR fixes this and introduces tests. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Prevents updating a user's phone number via updateUser. Requests now return 400 and keep phoneNumber and phoneNumberVerified unchanged. - **Bug Fixes** - Block phoneNumber updates on /update-user via a before hook; returns "Phone number cannot be updated". - Added tests to ensure the phone number can't be changed and verification state remains intact. <sup>Written for commit 50a41e4309602d03bccdcb1de6e7785320245a01. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. -->
GiteaMirror added the pull-request label 2026-04-13 09:30:42 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#14507