The EE secure passwords require one uppercase, one lowercase, and one numeric character. Is it possible to make the password also require at least one special character (@,!,#,$,&, etc)?
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
July 01, 2010 2:38pm
Subscribe [2]#1 / Jul 01, 2010 2:38pm
The EE secure passwords require one uppercase, one lowercase, and one numeric character. Is it possible to make the password also require at least one special character (@,!,#,$,&, etc)?
#2 / Jul 01, 2010 3:16pm
Not out of the box, I am afraid. This would require some hacking. Consider making a Feature Request.
#3 / Jul 01, 2010 6:05pm
Would this do it? I put a dash on each line that I modified or added.
core.validate.php
if ($PREFS->ini('require_secure_passwords') == 'y')
{
- $count = array('uc' => 0, 'lc' => 0, 'num' => 0, 'special' => 0);
$pass = preg_quote($this->password, "/");
$len = strlen($pass);
for ($i = 0; $i < $len; $i++)
{
$n = substr($pass, $i, 1);
if (preg_match("/^[[:upper:]]$/", $n))
{
$count['uc']++;
}
elseif (preg_match("/^[[:lower:]]$/", $n))
{
$count['lc']++;
}
elseif (preg_match("/^[[:digit:]]$/", $n))
{
$count['num']++;
}
- elseif (preg_match("/^[[:punct:]]$/", $n))
- {
- $count['special']++;
- }
}
foreach ($count as $val)
{
if ($val == 0)
{
return $this->errors[] = $LANG->line('not_secure_password');
}
}
}