Validate aliases, addresses and phone numbers in the send menu #176

Merged
kamikazechaser merged 14 commits from alias-address-validation into master 2024-11-26 07:24:57 +01:00
Showing only changes of commit e8bed3b07b - Show all commits

View File

@ -11,7 +11,7 @@ import (
const ( const (
phoneRegex = `^(?:\+254|254|0)?((?:7[0-9]{8})|(?:1[01][0-9]{7}))$` phoneRegex = `^(?:\+254|254|0)?((?:7[0-9]{8})|(?:1[01][0-9]{7}))$`
kamikazechaser marked this conversation as resolved
Review

alias is same format as email? May want to have a look at https://emailregex.com/

alias is same format as email? May want to have a look at https://emailregex.com/
Review

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

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`
Review
@Alfred-mk See https://github.com/grassrootseconomics/sarafu.network/issues/174 for Alias requirements
addressRegex = `^0x[a-fA-F0-9]{40}$` addressRegex = `^0x[a-fA-F0-9]{40}$`
aliasRegex = `^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+$` aliasRegex = `^[a-zA-Z0-9]+$`
) )
// IsValidPhoneNumber checks if the given number is a valid phone number // IsValidPhoneNumber checks if the given number is a valid phone number