Skip to content

Instantly share code, notes, and snippets.

@sonianand11
Last active March 4, 2016 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sonianand11/e55808b3880978c43ad7 to your computer and use it in GitHub Desktop.
Save sonianand11/e55808b3880978c43ad7 to your computer and use it in GitHub Desktop.
#View Original : https://github.com/plataformatec/devise/blob/master/app/controllers/devise/sessions_controller.rb
class Users::SessionsController < Devise::SessionsController
respond_to :json
# POST /resource/sign_in
def create
self.resource = warden.authenticate!(auth_options)
set_flash_message(:notice, :signed_in) if is_flashing_format?
sign_in(resource_name, resource)
respond_with(resource) do |format|
format.json { render json: {redirect_url: after_sign_in_path_for(resource)}, status: 200 }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment