I want to validate entered user password for complex character password,
Is there any package or method for this validation ?
I want to validate entered user password for complex character password,
Is there any package or method for this validation ?
this may help a lot to set at client side, or you can create similar at server side for regex pattern.
var password = document.getElementById('pswdfield').value;
var validLength = /.{8}/.test(password);
var hasCaps = /[A-Z]/.test(password);
var hasNums = /\d/.test(password);
var hasSpecials = /[~!,@#%&_\$\^\*\?\-]/.test(password);
var isValid = validLength && hasCaps && hasNums && hasSpecials;
in $rules validation array add
'password'=>'required|regex:/^.*(?=.{3,})(?=.*[a-zA-Z])(?=.*[0-9])(?=.*[\d\X])(?=.*[!$#%]).*$/'
If you want to use package give a try with this package.
https://packagist.org/search/?q=password-strength https://github.com/schuppo/PasswordStrengthPackage
And if you want to accomplish that using regular expression check this question. Here you'll find a detailed answer.