commit fc55d17667c64786b8237f110e14806bf9677003 Author: smarcet Date: Fri Oct 2 11:39:54 2020 -0300 Fixed password policy 8 characters (min) including one special character Change-Id: I716a9111f4a8df4eb6fa4b11d85c9ddd1eff5f8d Signed-off-by: smarcet diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 12f576c..cd77b04 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -96,11 +96,12 @@ class AppServiceProvider extends ServiceProvider }); Validator::extend("password_policy", function($attribute, $value, $parameters, $validator){ - $validator->addReplacer('password_policy', function($message, $attribute, $rule, $parameters) use ($validator) { - return sprintf("The %s must be 12–30 characters, and include a number or a symbol", $attribute); + $min = 8; + $validator->addReplacer('password_policy', function($message, $attribute, $rule, $parameters) use ($validator, $min) { + return sprintf("The %s must be %s–30 characters, and must include a special character", $attribute, $min); }); - return preg_match("/^((?=.*?[0-9])|(?=.*?[#?!@()$%^&*=_{}[\]:;\"'|<>,.\/~`±§+-])).{12,30}$/", $value); + return preg_match("/^((?=.*?[#?!@()$%^&*=_{}[\]:;\"'|<>,.\/~`±§+-])).{8,30}$/", $value); }); }