Validate aliases, addresses and phone numbers in the send menu #176
Reference in New Issue
Block a user
Delete Branch "alias-address-validation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
updated the regex to match all Kenyan numbersto WIP: updated the regex to match all Kenyan numbersWIP: updated the regex to match all Kenyan numbersto WIP: Validate aliases, addresses and phone numbers in the send menuWIP: Validate aliases, addresses and phone numbers in the send menuto Validate aliases, addresses and phone numbers in the send menu@@ -0,0 +7,4 @@// Define the regex patterns as constantsconst (phoneRegex = `^(?:\+254|254|0)?((?:7[0-9]{8})|(?:1[01][0-9]{7}))$`I think phone regex should be check formatting but not specifics; that is, country code should be filtered elsewhere.
@@ -0,0 +9,4 @@const (phoneRegex = `^(?:\+254|254|0)?((?:7[0-9]{8})|(?:1[01][0-9]{7}))$`addressRegex = `^0x[a-fA-F0-9]{40}$`aliasRegex = `^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+$`alias is same format as email? May want to have a look at https://emailregex.com/
No, it is not. This is the format that I picked from Sarafu's website
Your shortcode is a unique identifier that can be used by others to send you vouchers. It must be in the following format name@area@Alfred-mk See https://github.com/grassrootseconomics/sarafu.network/issues/174 for Alias requirements
@@ -916,2 +908,4 @@recipient := string(input)if recipient != "0" {when is recipient "0" ?
This is related to #126 (comment)
@@ -0,0 +49,4 @@}// FormatPhoneNumber formats a Kenyan phone number to "254xxxxxxxx".func FormatPhoneNumber(phone string) (string, error) {It should be + prefixed. Why? That is how we save it in our common db (graph) and also how most, if not all, API providers expect the phone number.
Thanks, this has been updated