Advertisement
Guest User

Untitled

a guest
Dec 8th, 2020
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.50 KB | None | 0 0
  1.     def create
  2.       self.resource = warden.authenticate!(auth_options)
  3.       set_flash_message!(:notice, :signed_in)
  4.       sign_in(resource_name, resource)
  5.       yield resource if block_given?
  6.  
  7.       respond_to do |format|
  8.         format.json do
  9.           if resource.errors.empty?
  10.             render json: resource, status: :ok
  11.           else
  12.             render json: { status: :unauthorized }
  13.           end
  14.         end
  15.         format.html do
  16.           super
  17.         end
  18.       end
  19.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement