Rails + Devise - Authenticate method in custom controller
Is there an equivalent to the Authenticate method from RestfulAuthentication开发者_开发知识库, like so?
@user = User.authenticate(@email, @password)
I have a custom controller i use for authenticating a mobile request, where the email/password come from the url, like http://localhost:3000/iphone/auth/frexuz@frexuz.com/mypassword
Maybe you can use something like this:
user = User.find(:first, :conditions => ["email = ?", @email])
user.valid_password?(@password) unless user.nil?
精彩评论