@umituz/react-native-auth 3.5.12 → 3.5.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-auth",
3
- "version": "3.5.12",
3
+ "version": "3.5.14",
4
4
  "description": "Authentication service for React Native apps - Secure, type-safe, and production-ready. Provider-agnostic design with dependency injection, configurable validation, and comprehensive error handling.",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -34,39 +34,8 @@ describe('AuthPasswordValidation', () => {
34
34
  expect(result.requirements.hasMinLength).toBe(false);
35
35
  });
36
36
 
37
- it('should validate uppercase requirement', () => {
38
- const configReq = { ...config, requireUppercase: true };
39
- expect(validatePasswordForRegister('password', configReq).isValid).toBe(false);
40
- expect(validatePasswordForRegister('Password', configReq).requirements.hasUppercase).toBe(true);
41
- });
42
-
43
- it('should validate lowercase requirement', () => {
44
- const configReq = { ...config, requireLowercase: true };
45
- expect(validatePasswordForRegister('PASSWORD', configReq).isValid).toBe(false);
46
- expect(validatePasswordForRegister('Password', configReq).requirements.hasLowercase).toBe(true);
47
- });
48
-
49
- it('should validate number requirement', () => {
50
- const configReq = { ...config, requireNumber: true };
51
- expect(validatePasswordForRegister('Password', configReq).isValid).toBe(false);
52
- expect(validatePasswordForRegister('Password1', configReq).requirements.hasNumber).toBe(true);
53
- });
54
-
55
- it('should validate special character requirement', () => {
56
- const configReq = { ...config, requireSpecialChar: true };
57
- expect(validatePasswordForRegister('Password1', configReq).isValid).toBe(false);
58
- expect(validatePasswordForRegister('Password1!', configReq).requirements.hasSpecialChar).toBe(true);
59
- });
60
-
61
- it('should accept password that meets all requirements', () => {
62
- const strictConfig = {
63
- ...config,
64
- requireUppercase: true,
65
- requireLowercase: true,
66
- requireNumber: true,
67
- requireSpecialChar: true,
68
- };
69
- const result = validatePasswordForRegister('Password1!', strictConfig);
37
+ it('should accept password that meets length requirement', () => {
38
+ const result = validatePasswordForRegister('Password1!', config);
70
39
  expect(result.isValid).toBe(true);
71
40
  });
72
41
  });
@@ -5,10 +5,6 @@
5
5
 
6
6
  export interface PasswordConfig {
7
7
  minLength: number;
8
- requireUppercase: boolean;
9
- requireLowercase: boolean;
10
- requireNumber: boolean;
11
- requireSpecialChar: boolean;
12
8
  }
13
9
 
14
10
  /**
@@ -48,10 +44,6 @@ export interface AuthConfig {
48
44
 
49
45
  export const DEFAULT_PASSWORD_CONFIG: PasswordConfig = {
50
46
  minLength: 6,
51
- requireUppercase: false,
52
- requireLowercase: false,
53
- requireNumber: false,
54
- requireSpecialChar: false,
55
47
  };
56
48
 
57
49
  export const DEFAULT_SOCIAL_CONFIG: SocialAuthConfig = {
@@ -3,24 +3,16 @@ import type { PasswordConfig } from "../../domain/value-objects/AuthConfig";
3
3
  export interface ValidationResult { isValid: boolean; error?: string; }
4
4
  export interface PasswordStrengthResult extends ValidationResult { requirements: PasswordRequirements; }
5
5
  export interface PasswordRequirements {
6
- hasMinLength: boolean; hasUppercase: boolean; hasLowercase: boolean; hasNumber: boolean; hasSpecialChar: boolean;
6
+ hasMinLength: boolean;
7
7
  }
8
8
 
9
9
  export interface ValidationConfig {
10
10
  emailRegex: RegExp;
11
- uppercaseRegex: RegExp;
12
- lowercaseRegex: RegExp;
13
- numberRegex: RegExp;
14
- specialCharRegex: RegExp;
15
11
  displayNameMinLength: number;
16
12
  }
17
13
 
18
14
  export const DEFAULT_VAL_CONFIG: ValidationConfig = {
19
15
  emailRegex: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
20
- uppercaseRegex: /[A-Z]/,
21
- lowercaseRegex: /[a-z]/,
22
- numberRegex: /[0-9]/,
23
- specialCharRegex: /[!@#$%^&*(),.?":{}|<>]/,
24
16
  displayNameMinLength: 2,
25
17
  };
26
18
 
@@ -41,28 +33,15 @@ export function validatePasswordForLogin(password: string): ValidationResult {
41
33
  export function validatePasswordForRegister(
42
34
  password: string,
43
35
  config: PasswordConfig,
44
- validationConfig: ValidationConfig = DEFAULT_VAL_CONFIG
36
+ _validationConfig: ValidationConfig = DEFAULT_VAL_CONFIG
45
37
  ): PasswordStrengthResult {
46
- /*
47
- * Check for strict presence of characters regardless of configuration
48
- * This ensures the UI reflects actual password content
49
- */
50
38
  const req: PasswordRequirements = {
51
39
  hasMinLength: password.length >= config.minLength,
52
- hasUppercase: validationConfig.uppercaseRegex.test(password),
53
- hasLowercase: validationConfig.lowercaseRegex.test(password),
54
- hasNumber: validationConfig.numberRegex.test(password),
55
- hasSpecialChar: validationConfig.specialCharRegex.test(password),
56
40
  };
57
41
 
58
42
  if (!password) return { isValid: false, error: "auth.validation.passwordRequired", requirements: req };
59
43
 
60
- // Validation checks based on configuration
61
44
  if (!req.hasMinLength) return { isValid: false, error: "auth.validation.passwordTooShort", requirements: req };
62
- if (config.requireUppercase && !req.hasUppercase) return { isValid: false, error: "auth.validation.passwordRequireUppercase", requirements: req };
63
- if (config.requireLowercase && !req.hasLowercase) return { isValid: false, error: "auth.validation.passwordRequireLowercase", requirements: req };
64
- if (config.requireNumber && !req.hasNumber) return { isValid: false, error: "auth.validation.passwordRequireNumber", requirements: req };
65
- if (config.requireSpecialChar && !req.hasSpecialChar) return { isValid: false, error: "auth.validation.passwordRequireSpecialChar", requirements: req };
66
45
 
67
46
  return { isValid: true, requirements: req };
68
47
  }
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import React, { useRef, useEffect } from "react";
7
- import { View, StyleSheet, TextInput } from "react-native";
7
+ import { StyleSheet, TextInput } from "react-native";
8
8
  import { AtomicInput, AtomicButton } from "@umituz/react-native-design-system";
9
9
  import { useLocalization } from "@umituz/react-native-localization";
10
10
  import { useLoginForm } from "../hooks/useLoginForm";
@@ -51,10 +51,6 @@ export const PasswordStrengthIndicator: React.FC<
51
51
 
52
52
  const items = [
53
53
  { key: "minLength", label: t("auth.passwordReq.minLength"), isValid: requirements.hasMinLength },
54
- { key: "uppercase", label: t("auth.passwordReq.uppercase"), isValid: requirements.hasUppercase },
55
- { key: "lowercase", label: t("auth.passwordReq.lowercase"), isValid: requirements.hasLowercase },
56
- { key: "number", label: t("auth.passwordReq.number"), isValid: requirements.hasNumber },
57
- { key: "special", label: t("auth.passwordReq.special"), isValid: requirements.hasSpecialChar },
58
54
  ];
59
55
 
60
56
  if (!showLabels) {
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import React, { useRef } from "react";
7
- import { View, StyleSheet, TextInput } from "react-native";
7
+ import { StyleSheet, TextInput } from "react-native";
8
8
  import { AtomicInput, AtomicButton } from "@umituz/react-native-design-system";
9
9
  import { useLocalization } from "@umituz/react-native-localization";
10
10
  import { useRegisterForm } from "../hooks/useRegisterForm";
@@ -4,7 +4,7 @@ import {
4
4
  StyleSheet,
5
5
  Platform,
6
6
  } from "react-native";
7
- import { useAppDesignTokens, Divider, AtomicButton } from "@umituz/react-native-design-system";
7
+ import { Divider, AtomicButton } from "@umituz/react-native-design-system";
8
8
  import { useLocalization } from "@umituz/react-native-localization";
9
9
  import type { SocialAuthProvider } from "../../domain/value-objects/AuthConfig";
10
10
 
@@ -31,7 +31,6 @@ export const SocialLoginButtons: React.FC<SocialLoginButtonsProps> = ({
31
31
  appleLoading = false,
32
32
  disabled = false,
33
33
  }) => {
34
- const tokens = useAppDesignTokens();
35
34
  const { t } = useLocalization();
36
35
 
37
36
  const safeEnabledProviders = enabledProviders ?? [];
@@ -8,7 +8,7 @@ import { useLocalization } from "@umituz/react-native-localization";
8
8
  import { useAuth } from "./useAuth";
9
9
  import { getAuthErrorLocalizationKey } from "../utils/getAuthErrorMessage";
10
10
  import { validateEmail, validatePasswordForLogin } from "../../infrastructure/utils/AuthValidation";
11
- import { AlertService, alertService } from "@umituz/react-native-design-system";
11
+ import { alertService } from "@umituz/react-native-design-system";
12
12
 
13
13
  export interface UseLoginFormResult {
14
14
  email: string;
@@ -14,7 +14,7 @@ import { DEFAULT_PASSWORD_CONFIG } from "../../domain/value-objects/AuthConfig";
14
14
  import { useAuth } from "./useAuth";
15
15
  import { getAuthErrorLocalizationKey } from "../utils/getAuthErrorMessage";
16
16
  import type { PasswordRequirements } from "../../infrastructure/utils/AuthValidation";
17
- import { AlertService, alertService } from "@umituz/react-native-design-system";
17
+ import { alertService } from "@umituz/react-native-design-system";
18
18
 
19
19
  export interface UseRegisterFormResult {
20
20
  displayName: string;
@@ -62,10 +62,6 @@ export function useRegisterForm(): UseRegisterFormResult {
62
62
  if (!password) {
63
63
  return {
64
64
  hasMinLength: false,
65
- hasUppercase: false,
66
- hasLowercase: false,
67
- hasNumber: false,
68
- hasSpecialChar: false,
69
65
  };
70
66
  }
71
67
  const result = validatePasswordForRegister(password, DEFAULT_PASSWORD_CONFIG);