sarvan75 / yii-user-management

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

Profile Update attempts to validate password #118

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Navigate to index.php/user/profile/update
2. Fill in Street field
3. Click 'Save Profile Changes'

What is the expected output? What do you see instead?
- expect to see "Your changes have been saved"
- instead see "Please fix the following input errors:
Password is too long (max. 16 characters)."

What version of the product are you using? On what operating system?
- Yii 1.1.7, YUM r321, XAMPP - Win7 x64

Please provide any additional information below.
It looks like the mass assignment is filling the password with the hashed pw 
from the database, then trying to validate it against std validation rules.  
There is no change pw operation on this update form, so it should not be 
validating the pw here at all.

Original issue reported on code.google.com by JJHayes...@gmail.com on 6 Apr 2011 at 6:08

GoogleCodeExporter commented 9 years ago
I've managed to (maybe) get around this, but avoiding the call to 
user->validate() and user->save();

Not sure what (if anything) this form uses from the user object.

From the Profile controller, update method:

-- = comment out
++ = add line

line 41ish:

        if(isset($_POST['User']))
        {
            $model->attributes=$_POST['User'];
            $profile->attributes=$_POST['Profile'];

            --if($model->validate()&&$profile->validate()) {
            ++if($profile->validate()){
                --$model->save();
                $profile->save();
                Yii::app()->user->setFlash('profileMessage',UserModule::t("Changes is saved."));
                $this->redirect(array('/user/profile'));
            } else $profile->validate();
        }

Original comment by Ryan.Gre...@gmail.com on 6 Jun 2011 at 3:48