Creating Rule To Checkaccess

For changing password I have an old_password field which is required only in case of normal user but it is not required if user is admin. So how can I create a rule to check this.

You should never save plain text password. You can only c’hange password but never read.

I think you have not understood my question. I have never mentioned that I am saving plain text password. I am saying that while updating password only normal user will be needing old password before updating new password while admin will not be needing old password for updating new password of any user.

try this




 array('password_repeat', 'compare', 'compareAttribute' => 'password', 'on' => 'normal user'),

What Maggie Q wanted to say but didn’t:

Use scenarios. In the action, check if user is an admin (using checkRules) and then switch model scenario based on that. In admin scenario the old password field will not be required and won’t be validated. In others it will be.

thanks for your suggestions