This article brings you relevant knowledge about Laravel. It mainly talks about how to implement password strength verification in Laravel? Friends who are interested can take a look below. I hope it will be helpful to everyone.
laravel password strength verification
Requirements
I hope the laravel framework allows users to enter Password strength can be conveniently specified when using the password
Includes:
It can be verified either mixedly or individually.
Official website: https://packagist.org/packages/schuppo/password-strength
Implementation:
1. Execute composer Install Laravel 6 and above according to the following scheme<p>composer require schuppo/password-strength:"~2.0"<br></p>
<p>composer require schuppo/password-strength:"~1.5"<br></p>
<p> "letters" => ":attribute 必须包含至少一个字母。",<br> "case_diff" => ":attribute 必须包含大小写字母。",<br> "numbers" => ":attribute 必须包含至少一个数字。",<br> "symbols" => ":attribute 必须包含至少一个符号。",<br></p>
<p>public function post(Request $request){<br> $validator = Validator::make($request->all(), [<br> 'name'=>'bail',<br> 'password'=>['bail','required','min:6','case_diff','numbers']<br> ]);<br><br> if ($validator->fails()) {<br> return $validator->errors()->first();<br> }<br> return '正确';}<br></p>
Summary
It smells so good! Recommended learning: "laravel video tutorial"
The above is the detailed content of Teach you how to easily implement password strength verification in Laravel!. For more information, please follow other related articles on the PHP Chinese website!