views:

35

answers:

1

I am using Devise and Rails 3. I want to perform a function that will simply verify that a user's username and password combination is correct without actually logging in that user. Is there some way I can accomplish something like User.authenticate(params[:username], params[:password]) with Devise?

A: 

well, Devise makes it automatically: when user sumbits login information, then it makes that check for you.

if you want more control, then you have 2 choices:

1- look at Devise sources finding where it makes that check

2- write your own login system (it's not that hard as you can think)

apeacox
It turns out that if the devise model (in my case, Person) has :database_authenticatable, then it creates a method called Person#valid_password?(password) that can be used to verify credentials. Pretty snazzy.
Adam Singer