Is there a way in devise that i can simply send in a url that contains a users password name or email and it registers the user or starts a new sessions, rather than actually logging in through the form (I want to simply send in username and password and login the user or register him)
Share
This is a generally a bad idea for numerous reasons, but if your use case demands it, there’s nothing stopping you from doing it.
Since Devise user records are just standard Active Record records, you can use finders on them like any other object:
u = User.find(:first, :conditions => {:username => 'foo'})And create them mostly like any other object:
Devise provides a
valid_password?instance method you can use to check the password of a retrieved object:u.valid_password?('monkey')And from any controller, you can call
sign_inwith a retrieved user object:sign_in(:user, u)