-
Notifications
You must be signed in to change notification settings - Fork 28
Description
The way this behavior works now, you hand out the hashed password to the user during an update. If the password content equals the hashed content, the password is not changed.
I don't particularly like the idea of sending pw hashes to the user. And it makes the behavior logic unneccessarly complex, as you have to save the original DB value in afterFind().
I'd find it much better, if the behavior used a dedicated property for new passwords from forms:
class X extends CActiveRecord
{
// Used in forms to let users enter a *new* password
public $newPassword;
//...
}The DB column (e.g. password) is never exposed to the user, only newPassword is. You can think of it as a one-way road for new passwords into our DB. Only if newPassword is not empty, a new hashed password is written to password.
This would simplify the behavior code quite a bit - and make it more transparent to the user, in case he wants to add additional validation to the newPassword column.