Added simple todo

This commit is contained in:
Franklin 2022-08-26 14:21:20 -04:00
parent 2f8038f740
commit 54272767f5

View File

@ -3,12 +3,14 @@ use dev_dtos::{dtos::user::user_dtos::{UserForCreationDto, UserForLoginDto}, dom
use crate::{resources::{variable_lengths::{MAX_EMAIL_LENGTH, MIN_EMAIL_LENGTH, MIN_NAME_LENGTH, MAX_NAME_LENGTH, MIN_PASSWORD_LENGTH, MAX_PASSWORD_LENGTH}, error_messages::{ERROR_INVALID_NAME, ERROR_INVALID_EMAIL, ERROR_INVALID_PASSWORD, ERROR_INVALID_PHONE_NUMBER}}, dto::message_resources_dtos::MessageResourceDto}; use crate::{resources::{variable_lengths::{MAX_EMAIL_LENGTH, MIN_EMAIL_LENGTH, MIN_NAME_LENGTH, MAX_NAME_LENGTH, MIN_PASSWORD_LENGTH, MAX_PASSWORD_LENGTH}, error_messages::{ERROR_INVALID_NAME, ERROR_INVALID_EMAIL, ERROR_INVALID_PASSWORD, ERROR_INVALID_PHONE_NUMBER}}, dto::message_resources_dtos::MessageResourceDto};
//TODO: Regex validation for emails
fn validate_user_email(email: &String) -> bool { fn validate_user_email(email: &String) -> bool {
email.len() >= MIN_EMAIL_LENGTH.into() && email.len() >= MIN_EMAIL_LENGTH.into() &&
email.len() <= MAX_EMAIL_LENGTH.into() && email.len() <= MAX_EMAIL_LENGTH.into() &&
email.contains('@') && email.contains('@') &&
email.contains('.') email.contains('.')
} }
//TODO: Regex validation for phone numbers
fn validate_user_phone_number(email: &String) -> bool { fn validate_user_phone_number(email: &String) -> bool {
email.len() >= CredentialType::get_max_length(&CredentialType::PhoneNumber) && email.len() >= CredentialType::get_max_length(&CredentialType::PhoneNumber) &&
email.len() <= MAX_EMAIL_LENGTH.into() email.len() <= MAX_EMAIL_LENGTH.into()