Recipe edit (WIP): all form fields are now saved
This commit is contained in:
parent
07b7ff425e
commit
6876a254e1
12 changed files with 563 additions and 210 deletions
|
|
@ -1,4 +1,5 @@
|
|||
use lazy_static::lazy_static;
|
||||
use std::sync::LazyLock;
|
||||
|
||||
use regex::Regex;
|
||||
|
||||
pub enum EmailValidation {
|
||||
|
|
@ -6,12 +7,12 @@ pub enum EmailValidation {
|
|||
NotValid,
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
static ref EMAIL_REGEX: Regex = Regex::new(
|
||||
r"^([a-z0-9_+]([a-z0-9_+.]*[a-z0-9_+])?)@([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,6})"
|
||||
static EMAIL_REGEX: LazyLock<Regex> = LazyLock::new(|| {
|
||||
Regex::new(
|
||||
r"^([a-z0-9_+]([a-z0-9_+.]*[a-z0-9_+])?)@([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,6})",
|
||||
)
|
||||
.expect("Error parsing email regex");
|
||||
}
|
||||
.expect("Error parsing email regex")
|
||||
});
|
||||
|
||||
pub fn validate_email(email: &str) -> EmailValidation {
|
||||
if EMAIL_REGEX.is_match(email) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue