How to check password before changing it?

Hello,
I’ve installed acts as authenticated plugin and I’m trying to change it
a little bit. I’ve created form where I can change my password. There
are 3 inputs: old pass, new and confirm new pass. In user model there
is:

(…)
attr_accessor :password
(…)
validates_presence_of :password, :if =>
:password_required?
validates_presence_of :password_confirmation, :if =>
:password_required?
validates_length_of :password, :within => 4…40, :if =>
:password_required?
validates_confirmation_of :password, :if =>
:password_required?
(…)

What should I do to check if old password is correct? Is it possible to
use validates_ do do it?

Cheers,
Stan

if Digest::SHA1.hexdigest(params[:oldpassword] ==
current_user.crypted_password

On Feb 10, 2008 8:31 PM, Stanley W. [email protected]
wrote:

validates_presence_of :password, :if =>
use validates_ do do it?

Cheers,
Stan

Posted via http://www.ruby-forum.com/.


Ryan B.

Feel free to add me to MSN and/or GTalk as this email.