Dear All,
I have a model User extends CActiveRecord. It consists of ID, Username and Password fields.
-
how could I check for duplicate on Username? if I tried to find the existing Username it is only work on new record, but update will always fails since it refers to itself. Any solution?
-
I store the password in MD5 form in the MySQL. I used beforeSave() to change the format to MD5 for new record. How could I make sure that on update, it will not be changed to md5 again?
Thanks for the help.
Kind regards,
Daniel