Validate: reject phone numbers that fail libphonenumber - #1584
Merged
Baskarayelu merged 5 commits intoJul 30, 2026
Merged
Conversation
…nges Conflict resolution for PR Remitwise-Org#1584.
…nges Conflict resolution for PR Remitwise-Org#1584.
…nges Conflict resolution for PR Remitwise-Org#1584.
…nges Conflict resolution for PR Remitwise-Org#1584.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
The profile settings phone field (
components/settings/ProfileSection.tsx) autosaved on every keystroke with no validation at all. AddsisValidProfilePhone()(lib/validation/phone.ts, wrappinglibphonenumber-js) and wires it intohandlePhoneChange: an invalid number shows an inlinerole="alert"error and skipstriggerSave(); a valid one clears the error and autosaves as before. An empty/whitespace value is treated as valid since the field isn't required. Requires an international (+-prefixed) number since there's no country selector to supply a default region.Also adds the new
settings.profile.phone_invalidtranslation key to bothen.json/es.json-- thesettings.*tree is otherwise entirely missing from the locale files (a large pre-existing gap, out of scope to backfill here), but I didn't want to add another broken key on top of it.Testing
node node_modules/vitest/vitest.mjs run ... tests/unit/validation/phone.test.ts tests/unit/settings/ProfileSection.test.tsx-- 8/8 pass (pure validation function edge cases, plus the component showing/clearing the error and not erroring on the valid initial value)npm run test:unit:vitest-- 305 passing (was 297 onmain), zero regressionsnpx eslinton all touched files -- cleannpx tsc --noEmit-- no new errors in any touched fileCloses #1470