I use laravel 5.1
I created custom password validation on this manual https://stackoverflow.com/a/28425173
Here is my validator
class StopWordsValidator extends Validator
{
public $stopWords = [
'admin',
'pass',
'test',
];
function validateStopWords($attribute, $value)
{
$find = false;
foreach ($this->stopWords as $word) {
if (strpos($value, $word) !== false) {
$find = true;
break;
}
}
return !$find;
}
}
I want show error like this - Password contains stop word {$word}
, and show instead $word words admin or pass
Also I want check, if password not contains login. For example, if user choose login bob and password bob123, I must not validate this password, because password contains login word.
How can I do this?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2ZfIwCh
via IFTTT
Aucun commentaire:
Enregistrer un commentaire