bhaveshsoni / yii-user-management

Automatically exported from code.google.com/p/yii-user-management
0 stars 0 forks source link

PasswordValidator #153

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. In main.cfg. I configure 'passwordRequirements' => array(
                        'minLen' => 4,
                        'maxLen' => 15,
                    ),
2. Execute password recovery

What is the expected output? What do you see instead?
if my password is '123 'hope that the validator accept it, but when using the 
save() method of the user model is not updated. The validator checks the 
encrypted password that exceeds the maximum characters.

What version of the product are you using? On what operating system?
latest svn. Yii 1.1.8

Original issue reported on code.google.com by a.tequ...@gmail.com on 20 Aug 2011 at 8:18

GoogleCodeExporter commented 8 years ago
if my password is '1234567890'. Sorry 

Original comment by a.tequ...@gmail.com on 20 Aug 2011 at 8:19

GoogleCodeExporter commented 8 years ago
my solution is add in YumUser.php

    public function beforeSave() {
        if ( isset($this->password) && ($this->password_changed) ) {
            $this->password = YumUser::encrypt($this->password);
        } 
        return parent::beforeSave();
    }

and in the setPassword function comment this line
//$this->password = YumUser::encrypt($password);

Finally i use setPassword function to assign the password. 

Is it a good solution?

Best regards.

Original comment by a.tequ...@gmail.com on 21 Aug 2011 at 7:48