Sha256: 81c1fb13a18f9c81cb8a558cf75b6280803feb69bd4e9fb024497c0bc7a573ce

Contents?: true

Size: 1.13 KB

Versions: 14

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

class Ibrain::UserSessionsController < 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

  def apple_repo
    AppleRepository.new(resource, request.env['omniauth.auth'])
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
its-ruby-auth-0.0.1 lib/controllers/ibrain/user_sessions_controller.rb
ibrain-auth-0.3.20 lib/controllers/ibrain/user_sessions_controller.rb
ibrain-auth-0.3.19 lib/controllers/ibrain/user_sessions_controller.rb
ibrain-auth-0.3.18 lib/controllers/ibrain/user_sessions_controller.rb
ibrain-auth-0.3.17 lib/controllers/ibrain/user_sessions_controller.rb
ibrain-auth-0.3.16 lib/controllers/ibrain/user_sessions_controller.rb
ibrain-auth-0.3.15 lib/controllers/ibrain/user_sessions_controller.rb
ibrain-auth-0.3.14 lib/controllers/ibrain/user_sessions_controller.rb
ibrain-auth-0.3.13 lib/controllers/ibrain/user_sessions_controller.rb
ibrain-auth-0.3.12 lib/controllers/ibrain/user_sessions_controller.rb
ibrain-auth-0.3.11 lib/controllers/ibrain/user_sessions_controller.rb
ibrain-auth-0.3.10 lib/controllers/ibrain/user_sessions_controller.rb
ibrain-auth-0.3.9 lib/controllers/ibrain/user_sessions_controller.rb
ibrain-auth-0.3.8 lib/controllers/ibrain/user_sessions_controller.rb