Replace Rusqlite by Sqlx and Actix by Axum (A lot of changes)
This commit is contained in:
parent
57d7e7a3ce
commit
980c5884a4
28 changed files with 2860 additions and 2262 deletions
|
|
@ -1,2 +1,2 @@
|
|||
pub mod ron_api;
|
||||
pub mod utils;
|
||||
pub mod ron_api;
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
use ron::de::from_reader;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use regex::Regex;
|
||||
use lazy_static::lazy_static;
|
||||
use regex::Regex;
|
||||
|
||||
pub enum EmailValidation {
|
||||
Ok,
|
||||
|
|
@ -7,11 +7,18 @@ pub enum EmailValidation {
|
|||
}
|
||||
|
||||
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})").expect("Error parsing email regex");
|
||||
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})"
|
||||
)
|
||||
.expect("Error parsing email regex");
|
||||
}
|
||||
|
||||
pub fn validate_email(email: &str) -> EmailValidation {
|
||||
if EMAIL_REGEX.is_match(email) { EmailValidation::Ok } else { EmailValidation::NotValid }
|
||||
if EMAIL_REGEX.is_match(email) {
|
||||
EmailValidation::Ok
|
||||
} else {
|
||||
EmailValidation::NotValid
|
||||
}
|
||||
}
|
||||
|
||||
pub enum PasswordValidation {
|
||||
|
|
@ -20,5 +27,9 @@ pub enum PasswordValidation {
|
|||
}
|
||||
|
||||
pub fn validate_password(password: &str) -> PasswordValidation {
|
||||
if password.len() < 8 { PasswordValidation::TooShort } else { PasswordValidation::Ok }
|
||||
}
|
||||
if password.len() < 8 {
|
||||
PasswordValidation::TooShort
|
||||
} else {
|
||||
PasswordValidation::Ok
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue