Skip to Content

Contact verification no longer says a code was sent when it wasn’t

Shipped 2026-10-20

Sign-up email verification and the profile email/phone change sent a code and replied “Please check your email address” without checking the result. During the 2026-10-19 outage, or after a typo in the new address, the member waited for a code that never came.

One shared service

The same verification code had been copied between auth/signup/service/signup.js and account/profile/service/communication.service.js, ignored result included. Both now use shared/contact-verification:

  • resolveChannel(body) (domain, table-tested) decides whether a request is for an email address, a phone number, or neither.
  • ContactVerificationService.sendCode(target) resolves the phone dialling code before generating a code, so a bad country no longer uses up a send. It reports a failed email with the cause from TUN-898, so the member sees “something went wrong on our side” or “your email provider rejected it” as appropriate.
  • checkCode(passcode) validates the verify code (TUN-900) and consumes it.

What a verified address unlocks stays with each flow. Sign-up promotes a Pending account to Flyer. Profile saves the new email or phone, and upgrades a Pending member.

Failures come back as 422, the response the www profile screen and the mobile app already handle for the rate limit, so neither needed a release. The profile screen shows the message and stays on the form.

Codes are bound to the address they were sent to

The profile flow sent a code to one address and saved whichever address came back with it. A member could receive a code at an address they owned and save a different one as verified, so “verified” didn’t mean verified.

Migration 0020 adds target to members_passcode. sendCode stores a normalised key for the address (targetKey: email lower-cased; phone as country plus digits), and checkCode requires the same key. A right code for the wrong address counts as a wrong code, with the same attempt counter and message, so it can’t be used to probe. It’s logged as passcode.validate.mismatch with reason: target. Sign-up binds to the email the account was created with.

Rows written before 0020 have no target and are accepted for their remaining ten minutes, so nobody is cut off mid-change during the deploy.

Follow-up: profile now saves the verified values from target, not req.body, so what’s stored is exactly what the code was checked against. A phone is accepted only as 6–15 digits (spaces and dashes stripped). Anything else is refused before a code is sent, rather than normalised.

Also fixed

  • invalidRequest was referenced but missing from the response messages, so those 422s had an empty message. It now exists in en/fr/es.

  • www/src/assets/scripts/app/account/verify/ was removed. No page loaded it, and it called two endpoints (/user/send-verification-passcode, /user/verify-user) that don’t exist.

  • Jira: TUN-901 

  • Author: @alexhobday

Last updated on