ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Secure password requirements

July 01, 2010 2:38pm

Subscribe [2]
  • #1 / Jul 01, 2010 2:38pm

    kevinm81

    12 posts

    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

    Ingmar

    29245 posts

    Not out of the box, I am afraid. This would require some hacking. Consider making a Feature Request.

  • #3 / Jul 01, 2010 6:05pm

    kevinm81

    12 posts

    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');
                    }
                }
            }
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases