Merge pull request #274 from mozilla/pb/273-email-address-regex
https://github.com/mozilla/fxa-email-service/pull/274 r=vladikoff
This commit is contained in:
Коммит
f114c7864f
|
@ -26,7 +26,7 @@ lazy_static! {
|
|||
r"^https?://[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*(?::[0-9]+)?/(?:[A-Za-z0-9-]+/)*$"
|
||||
).unwrap();
|
||||
static ref EMAIL_ADDRESS_FORMAT: Regex = Regex::new(
|
||||
r"^[a-zA-Z0-9.\pL\pN!#$%&’*+/=?^_`{|}~-]{1,64}@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,253}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,253}[a-zA-Z0-9])?)+$"
|
||||
r"^[a-zA-Z0-9.\pL\pN!#$%&'*+/=?^_`{|}~-]{1,64}@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,253}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,253}[a-zA-Z0-9])?)+$"
|
||||
).unwrap();
|
||||
static ref HOST_FORMAT: Regex = Regex::new(r"^[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*$").unwrap();
|
||||
static ref SENDER_NAME_FORMAT: Regex =
|
||||
|
|
|
@ -108,6 +108,7 @@ fn email_address() {
|
|||
"a@{}.b",
|
||||
random_alphanum_string(249)
|
||||
)));
|
||||
assert!(validate::email_address("a'b@example.com"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -125,6 +126,7 @@ fn invalid_email_address() {
|
|||
"a@{}.b",
|
||||
random_alphanum_string(250)
|
||||
)));
|
||||
assert!(!validate::email_address("a’b@example.com"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Загрузка…
Ссылка в новой задаче