I would like to do a 'sign-in or register' on the fly when posting a comment to my forum. I am using Devise/Warden.
I want to do something like this:
user = warden.authenticate!(params[:email], params[:password])
sign_in(:user, user)
Can anyone give me some tips on how to do this?
Thanks!
Warden has a set_user
helper method. So you should be able to do:
warden.set_user(@user, scope: :user)
You could probably define a controller helper method, to sign in the user and redirect them to your desired path
More information is available at: https://github.com/hassox/warden/wiki/Authenticated-session-data