I’m using Yii for an application, I’m writing a very simple user management, like registering, deleting and updating users… For updating the existing user I need to check the old password first before change it to the new inserted password. So here is the fields I have in the form:
username:----
old_password:---
new_password:---
and my user table looks like this:
id, username, password
How can I validate the old_password before updating it with the new_password? I know the usual php coding, but I want to know if there are any Yii tricks that does this automatically…
Thanks in advance
Its simple create a
actionthat has logic for update pass.Make target for
formto newactionin this caseactionChangePassandvalidatethere the way you want .A rough example can be put like this
Also make sure you have $old_password in your user
UserModel. Also you can do some validations in rules of model to make new password requiredthere can be some different ways too but i do it like this
Also create your custom validation
scenariochangePassword