How To Validate Old Password

Hi i have three fields in yii change password form as old_password,new_password,confirm_password. I would like to validate old_password matched or not in yii method.

I would expect the answer for this . Thank you.

Basic steps to validate Old Password:

  1. Perform DB query for retrieving the actual password(current active password).

If you store the password after hashing :

 => Get the old_password from the form and hash this old_password
  1. Compare two password if they match or not