Trimming emailaddress from user
This commit is contained in:
parent
415d759fb6
commit
4bf30d1fca
@ -103,7 +103,7 @@ fn validate_name(name: &String) -> bool {
|
||||
fn validate_email(email: &String) -> bool {
|
||||
// Check if the emailaddress is valid
|
||||
// This function is not completely correct: emailregex.com
|
||||
Regex::new(r"^[a-zA-Z0-9\.\-_]+@[a-zA-Z0-9\-\.]+\.[a-zA-Z]+$").unwrap().is_match(email)
|
||||
Regex::new(r"^[a-zA-Z0-9\.\-_]+@[a-zA-Z0-9\-\.]+\.[a-zA-Z]+$").unwrap().is_match(email.trim())
|
||||
}
|
||||
|
||||
fn validate_guests(guests: &u8) -> bool {
|
||||
@ -247,7 +247,7 @@ fn submit_task (host: HostHeader,
|
||||
if x.guests > 0 {
|
||||
// Send email about attendaning wedding
|
||||
result = send_email(&x.name,
|
||||
&x.email,
|
||||
&x.email.trim().to_string(),
|
||||
&language_strings.attending_email.subject,
|
||||
&strfmt(&language_strings.attending_email.message, &vars).unwrap(),
|
||||
Some(&language_strings.attending_email.attachment), //attachment
|
||||
@ -256,7 +256,7 @@ fn submit_task (host: HostHeader,
|
||||
} else {
|
||||
// Send email about not attending wedding
|
||||
result = send_email(&x.name,
|
||||
&x.email,
|
||||
&x.email.trim().to_string(),
|
||||
&language_strings.not_attending_email.subject,
|
||||
&strfmt(&language_strings.not_attending_email.message, &vars).unwrap(),
|
||||
None, // No attachment
|
||||
|
Loading…
Reference in New Issue
Block a user