Closed g-i-g closed 4 years ago
looks good, but we also ensure phone numbers are at most 12 digits before passing to the DB (i.e. +1 (540) 231-9888 -> 15402319888; I believe country codes are at most 3 digits but we really should only ever see +1 anyway), and are one of 5 (1-9888), 7 (231-9888), or >=9 ((540) 231-9888) digits long.
(If you wanted to be a real stickler, you could also raise an alert if those failed, and ensure 5-digit VT extensions always start with 1 or 2)
@echarlie I've added a length check in commit feffc2c
. I think just checking to see if it exceeds 12 is satisfactory.
I agree that we should check for minimum length too, but let's just go ahead and get this fix in now.
Historically, we've had improper phone numbers ("improper" meaning any number string that contained any special characters except for -) throw exceptions on donation since the Postgres database expects VARCHAR(12). This commit fixes that by reducing any given input down to just numbers.