Allow internal TLDs and special characters in e-mail addresses
This commit is contained in:
@@ -27,7 +27,7 @@ If you are upgrading from v0.16.x, replace the binary (or run `docker pull`). If
|
|||||||
- ACME:
|
- ACME:
|
||||||
- Update `defaultCertificateId` when renewing a certificate that is currently set as default.
|
- Update `defaultCertificateId` when renewing a certificate that is currently set as default.
|
||||||
- Perform `DNS-01` authorizations sequentially to avoid race conditions in some DNS providers.
|
- Perform `DNS-01` authorizations sequentially to avoid race conditions in some DNS providers.
|
||||||
- Allow internal TLDs in e-mail addresses.
|
- Allow internal TLDs and special characters in e-mail addresses.
|
||||||
- Websocket: Perform case insensitive matching during upgrade.
|
- Websocket: Perform case insensitive matching during upgrade.
|
||||||
- LDAP: Synchronize accounts when expanding mailing list recipients.
|
- LDAP: Synchronize accounts when expanding mailing list recipients.
|
||||||
- Sieve: `replace` action adds an extra `From` header.
|
- Sieve: `replace` action adds an extra `From` header.
|
||||||
|
|||||||
@@ -213,10 +213,14 @@ pub fn sanitize_email(email: &str) -> Option<String> {
|
|||||||
|
|
||||||
for ch in chars.by_ref() {
|
for ch in chars.by_ref() {
|
||||||
match ch {
|
match ch {
|
||||||
'.' | '+' | '-' | '_' => {
|
'.' => {
|
||||||
if !last_ch.is_alphanumeric() {
|
if last_ch == NIL_CHAR || last_ch == '.' {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
result.push('.');
|
||||||
|
}
|
||||||
|
'!' | '#' | '$' | '%' | '&' | '\'' | '*' | '+' | '-' | '/' | '=' | '?' | '^' | '_'
|
||||||
|
| '`' | '{' | '|' | '}' | '~' => {
|
||||||
result.push(ch);
|
result.push(ch);
|
||||||
}
|
}
|
||||||
' ' | '\x09'..='\x0d' => continue,
|
' ' | '\x09'..='\x0d' => continue,
|
||||||
@@ -288,10 +292,14 @@ pub fn sanitize_email_local(local: &str) -> Option<String> {
|
|||||||
|
|
||||||
for ch in local.chars() {
|
for ch in local.chars() {
|
||||||
match ch {
|
match ch {
|
||||||
'.' | '+' | '-' | '_' => {
|
'.' => {
|
||||||
if !last_ch.is_alphanumeric() {
|
if last_ch == NIL_CHAR || last_ch == '.' {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
result.push('.');
|
||||||
|
}
|
||||||
|
'!' | '#' | '$' | '%' | '&' | '\'' | '*' | '+' | '-' | '/' | '=' | '?' | '^' | '_'
|
||||||
|
| '`' | '{' | '|' | '}' | '~' => {
|
||||||
result.push(ch);
|
result.push(ch);
|
||||||
}
|
}
|
||||||
' ' | '\x09'..='\x0d' => continue,
|
' ' | '\x09'..='\x0d' => continue,
|
||||||
|
|||||||
Reference in New Issue
Block a user