Day 4

Ryan Strickler
Dec 1, 2016 · 1 min read

Got phone number storage and testing squared away today. Ended up with these columns in the phone table, which feels simple and clean:

number
token
confirmed_at

Next, I need to connect to Twilio and send the confirmation link. Eventually, I’d like to expire these tokens as well to make the things more secure.

There are a few edge cases to consider when validating US phone numbers, which is where I’m starting. The number might be too long, too short, or it might be formatted strangely. To handle formatting issues, the first thing I do when validating the number is strip out anything non-numeric. This allows the visitor to enter the number in any format that makes sense to them and avoids those weird phone number forms with multiple boxes. If the number is 10 digits long, or 11 digits long and starts with a “1”, then the number is good. Anything else returns an error. Store it with the “+1” at the front for ease of use with Twilio and we’re off to the races.

This is my first time creating a phone-first sign up process. I’d love to hear about anything I missed or how you approached a similar problem.

Little King: Daily Log

Building something every day.

Ryan Strickler

Written by

Building something every day. Launching something new every 6 weeks. Writing about everything along the way.

Little King: Daily Log

Building something every day. Launching something new every 7 weeks. Writing about everything along the way.

Ryan Strickler

Written by

Building something every day. Launching something new every 6 weeks. Writing about everything along the way.

Little King: Daily Log

Building something every day. Launching something new every 7 weeks. Writing about everything along the way.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store