Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

fix(users): Revert add password validations (#4542)

Riddhiagrawal001bcce8b0489aa
diff --git a/crates/router/src/consts/user.rs b/crates/router/src/consts/user.rs
index f14610649f..1cda969f78 100644
--- a/crates/router/src/consts/user.rs
+++ b/crates/router/src/consts/user.rs
@@ -1,5 +1,3 @@
pub const MAX_NAME_LENGTH: usize = 70;
pub const MAX_COMPANY_NAME_LENGTH: usize = 70;
pub const BUSINESS_EMAIL: &str = "[email protected]";
-pub const MAX_PASSWORD_LENGTH: usize = 70;
-pub const MIN_PASSWORD_LENGTH: usize = 8;
diff --git a/crates/router/src/types/domain/user.rs b/crates/router/src/types/domain/user.rs
index aed1bb02e7..b4b5df2f46 100644
--- a/crates/router/src/types/domain/user.rs
+++ b/crates/router/src/types/domain/user.rs
@@ -158,32 +158,7 @@ pub struct UserPassword(Secret<String>);
impl UserPassword {
pub fn new(password: Secret<String>) -> UserResult<Self> {
let password = password.expose();
-
- let mut has_upper_case = false;
- let mut has_lower_case = false;
- let mut has_numeric_value = false;
- let mut has_special_character = false;
- let mut has_whitespace = false;
-
- for c in password.chars() {
- has_upper_case = has_upper_case || c.is_uppercase();
- has_lower_case = has_lower_case || c.is_lowercase();
- has_numeric_value = has_numeric_value || c.is_numeric();
- has_special_character =
- has_special_character || !(c.is_alphanumeric() && c.is_whitespace());
- has_whitespace = has_whitespace || c.is_whitespace();
- }
-
- let is_password_format_valid = has_upper_case
- && has_lower_case
- && has_numeric_value
- && has_special_character
- && !has_whitespace;
-
- let is_too_long = password.graphemes(true).count() > consts::user::MAX_PASSWORD_LENGTH;
- let is_too_short = password.graphemes(true).count() < consts::user::MIN_PASSWORD_LENGTH;
-
- if is_too_short || is_too_long || !is_password_format_valid {
+ if password.is_empty() {
Err(UserErrors::PasswordParsingError.into())
} else {
Ok(Self(password.into()))