MCPcopy Create free account
hub / github.com/bytebase/bytebase / ValidatePhone

Function ValidatePhone

backend/common/util.go:149–158  ·  view source on GitHub ↗

ValidatePhone validates the phone number.

(phone string)

Source from the content-addressed store, hash-verified

147
148// ValidatePhone validates the phone number.
149func ValidatePhone(phone string) error {
150 phoneNumber, err := phonenumbers.Parse(phone, "")
151 if err != nil {
152 return err
153 }
154 if !phonenumbers.IsValidNumber(phoneNumber) {
155 return errors.New("invalid phone number")
156 }
157 return nil
158}
159
160// emailRegex is based on the WHATWG HTML spec for valid email addresses.
161// https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address

Callers 5

UserInfoMethod · 0.92
UserInfoMethod · 0.92
CreateUserMethod · 0.92
UpdateUserMethod · 0.92
TestValidatePhoneFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestValidatePhoneFunction · 0.68