Sha256: 0a0595b70ac2920bfbc40607df9f60e17deff528f8bb60350b049925bf9f7f32
Contents?: true
Size: 687 Bytes
Versions: 3
Compression:
Stored size: 687 Bytes
Contents
class ApplicationController < ActionController::Base before_action :authenticate_user! helper_method :current_user helper_method :authenticate_user! def authenticate_user! if current_user.blank? respond_to do |format| format.html { redirect_to "/auth/infinum?origin=#{request.url}" } format.json { render :json => { 'error' => 'Access Denied' }.to_json } end end end def current_user return nil unless session[:user_id] @current_user ||= User.new_from_omniauth(session[:user_id]) end # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception end
Version data entries
3 entries across 3 versions & 1 rubygems