@jumboteam
Don't try and re-invent the wheel; use the already existing functions...if you would've preformed a search for "password" in the codebase you would've eventually stumbled across function setPassword($new, $current) {}. This function set's the staff's password. It takes two parameters $new and $current. $new is the new password you'd like to set and $current is the agent's current password.
Cheers.