I have implemented restful authentication plugin in my rails application. It’s a barebones implementation without activation, forget password features …etc. I was wondering if it is possible to reset a User’s password from the rails console? As things stand now, there is no other way to reset their passwords :).
I have implemented restful authentication plugin in my rails application.
It’s a barebones implementation without activation, forget password features
…etc. I was wondering if it is possible to reset a User’s password from
the rails console? As things stand now, there is no other way to reset their
passwords :).
Haven’t used restful auth in a long long time, but you should be able
to do exactly what a controller would do when setting a password:
The users table has crypted_password, and salt columns which is giving me problems when I try to reset password from the console.After reading the documentation for restful authentication, it appears that the I need to store the hashed password in crypted_password field. Therefore, I approached the problem as follows:
the password needs to be hashed with the salt. However you don't to
know any of that - normally you'll have a
before_save :encrypt_password or something like that: if you set
password & password_confirmation then restful auth will do the hashing
for you when you save the record
I have implemented restful authentication plugin in my rails
application.
[...]
Great. Now take it out and put in Authlogic or something.
restful_authentication relies on unmaintainable generated code, and no
Rails developer should even consider using it now that better
alternatives exist.
You got it spot on! It finally worked. I was barking up the wrong tree. Thanks a lot for your help mate! Now I’ve got to figure out the rest of the functionality for my application. But at least now I know where to seek help
Apparently I was looking in the wrong places or was reading dated RoR stuff 'cause wherever I looked RA was the overwhelming favorite for authentication. But considering the problems I’ve had thus far with RA, I’ll surely look into authlogic for my next project. If I run into any problems, I’m sure I can count on your help
Apparently I was looking in the wrong places or was reading dated RoR
stuff
'cause wherever I looked RA was the overwhelming favorite for
authentication.
It used to be. It's pretty easy to use, and its API isn't bad (though
not as slick as Authlogic). The problem is all the crap it puts in your
User model, mixed in with the code you actually wanted to have in there.
Authlogic is much more self-contained. (I've heard good things about
Devise and some others too, but never tried them.)
But considering the problems I've had thus far with RA,
I'll
surely look into authlogic for my next project. If I run into any
problems,
I'm sure I can count on your help
I'll be what help I can.
Thanks and Regards,
Andrew
On Sat, May 29, 2010 at 12:17 AM, Marnen Laibow-Koser