Sha256: ed7c60e8674a8ff434fe4e4a30d20e52124e0f995cf5e1209e7ccf4c1e4cb46b

Contents?: true

Size: 1.05 KB

Versions: 6

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

class Ibrain::Auth::SessionsController < Devise::SessionsController
  include ActionController::Helpers
  include Ibrain::Core::ControllerHelpers::Response
  include ActionController::MimeResponds

  # before_action :configure_sign_in_params, only: [:create]

  def create
    user = repo.sign_in
    sign_in(resource_name, user) if user.present?

    super { |resource| @resource = resource }
  end

  def callback
    user = line_repo.find_or_initialize!

    render_json_ok(user, nil)
  end

  # GET /resource/sign_in
  # def new
  #   super
  # end

  # POST /resource/sign_in
  # def create
  #   super
  # end

  # DELETE /resource/sign_out
  # def destroy
  #   super
  # end

  # protected

  # If you have extra params to permit, append them to the sanitizer.
  # def configure_sign_in_params
  #   devise_parameter_sanitizer.permit(:sign_in, keys: [:attribute])
  # end

  private

  def repo
    AuthRepository.new(resource, params)
  end

  def line_repo
    LineRepository.new(resource, request.env['omniauth.auth'])
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ibrain-auth-0.3.7 app/controllers/ibrain/auth/sessions_controller.rb
ibrain-auth-0.3.6 app/controllers/ibrain/auth/sessions_controller.rb
ibrain-auth-0.3.5 app/controllers/ibrain/auth/sessions_controller.rb
ibrain-auth-0.3.4 app/controllers/ibrain/auth/sessions_controller.rb
ibrain-auth-0.3.3 app/controllers/ibrain/auth/sessions_controller.rb
ibrain-auth-0.3.2 app/controllers/ibrain/auth/sessions_controller.rb