diff --git a/app/init/constants.php b/app/init/constants.php index 84b7ea46cd..b271b56a14 100644 --- a/app/init/constants.php +++ b/app/init/constants.php @@ -37,7 +37,6 @@ const APP_LIMIT_COMPRESSION = 20_000_000; //20MB const APP_LIMIT_ARRAY_PARAMS_SIZE = 100; // Default maximum of how many elements can there be in API parameter that expects array value const APP_LIMIT_ARRAY_LABELS_SIZE = 1000; // Default maximum of how many labels elements can there be in API parameter that expects array value const APP_LIMIT_ARRAY_ELEMENT_SIZE = 4096; // Default maximum length of element in array parameter represented by maximum URL length. -const APP_LIMIT_USER_SESSIONS_DEFAULT = 10; // Default maximum sessions allowed per user const APP_LIMIT_SUBQUERY = 1000; const APP_LIMIT_SUBSCRIBERS_SUBQUERY = 1_000_000; const APP_LIMIT_WRITE_RATE_DEFAULT = 60; // Default maximum write rate per rate period diff --git a/src/Appwrite/Auth/Validator/PasswordPolicy.php b/src/Appwrite/Auth/Validator/PasswordPolicy.php index 6fdb11d15a..e39b0b07ab 100644 --- a/src/Appwrite/Auth/Validator/PasswordPolicy.php +++ b/src/Appwrite/Auth/Validator/PasswordPolicy.php @@ -80,7 +80,7 @@ class PasswordPolicy extends Password return false; } - if ($this->requireSpecialChar && !\preg_match("/[!\"#$%&'()*+,\-.\/:;<=>?@[\\\\\]^_`{|}~]/", $value)) { + if ($this->requireSpecialChar && !\preg_match('/[^\p{L}\p{N}\s]/u', $value)) { return false; } diff --git a/src/Appwrite/Platform/Modules/Projects/Http/Projects/Create.php b/src/Appwrite/Platform/Modules/Projects/Http/Projects/Create.php index 252e5d8dbd..e3a9be3711 100644 --- a/src/Appwrite/Platform/Modules/Projects/Http/Projects/Create.php +++ b/src/Appwrite/Platform/Modules/Projects/Http/Projects/Create.php @@ -81,7 +81,7 @@ class Create extends Action $auth = Config::getParam('auth', []); $auths = [ 'limit' => 0, - 'maxSessions' => \APP_LIMIT_USER_SESSIONS_DEFAULT, + 'maxSessions' => 0, 'passwordPolicy' => [ 'minLength' => 8, 'requireUppercase' => false, diff --git a/src/Appwrite/Utopia/Response/Model/Project.php b/src/Appwrite/Utopia/Response/Model/Project.php index c3797eade2..f13def6a36 100644 --- a/src/Appwrite/Utopia/Response/Model/Project.php +++ b/src/Appwrite/Utopia/Response/Model/Project.php @@ -523,7 +523,7 @@ class Project extends Model $document->setAttribute('authLimit', $authValues['limit'] ?? 0); $document->setAttribute('authDuration', $authValues['duration'] ?? TOKEN_EXPIRATION_LOGIN_LONG); - $document->setAttribute('authSessionsLimit', $authValues['maxSessions'] ?? \APP_LIMIT_USER_SESSIONS_DEFAULT); + $document->setAttribute('authSessionsLimit', $authValues['maxSessions'] ?? 0); $document->setAttribute('authPasswordHistory', $authValues['passwordHistory'] ?? 0); $document->setAttribute('authPasswordPolicyMinLength', $passwordPolicy['minLength'] ?? 8); $document->setAttribute('authPasswordPolicyRequireUppercase', $passwordPolicy['requireUppercase'] ?? false); diff --git a/tests/unit/Auth/Validator/PasswordPolicyTest.php b/tests/unit/Auth/Validator/PasswordPolicyTest.php index a342455f61..048a1d3f60 100644 --- a/tests/unit/Auth/Validator/PasswordPolicyTest.php +++ b/tests/unit/Auth/Validator/PasswordPolicyTest.php @@ -31,6 +31,7 @@ class PasswordPolicyTest extends TestCase $this->assertFalse($validator->isValid('PasswordOnly!')); $this->assertFalse($validator->isValid('Password1234')); $this->assertTrue($validator->isValid('Password123!')); + $this->assertTrue($validator->isValid('Password123€')); } public function testAllowEmpty(): void