Skip to content

Instantly share code, notes, and snippets.

@hugueslamy
Created July 2, 2016 17:25
Show Gist options
  • Save hugueslamy/c260a2d78195936606fefcb1616d27fd to your computer and use it in GitHub Desktop.
Save hugueslamy/c260a2d78195936606fefcb1616d27fd to your computer and use it in GitHub Desktop.
Snippet of code to manually connect Devise without going to warden strategies.
def create
resource = User.find_for_database_authentication(email: params[:user][:email])
return invalid_login_attempt unless resource
if resource.valid_password?(params[:user][:password])
sign_in :user, resource
return render nothing: true
end
invalid_login_attempt
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment