Sha256: ba997f07d87eb92061329412d6ef3999432d5617be8c9a049ac5b42226d37654

Contents?: true

Size: 757 Bytes

Versions: 2

Compression:

Stored size: 757 Bytes

Contents

module Phcpresspro
	class ApplicationController < ActionController::Base

		# Prevent CSRF attacks by raising an exception.
		# For APIs, you may want to use :null_session instead.
		before_filter :require_user
		protect_from_forgery with: :exception
		
		

		def require_user
			unless current_user
				session[:last_url] = request.get? ? url_for(params) : url_for
				redirect_to new_login_url
			end
		end

		def current_user
			@_current_user ||= AuthRocket::Session.from_token(session[:ar_token]).try(:user)
		end
		helper_method :current_user

		def new_login_url
			ENV['AUTHROCKET_LOGIN_URL']
			# $ar_login_url
		end
		helper_method :new_login_url

		# Load Helpers
		helper Phctitleseo::Engine.helpers
		helper Phcnotifi::Engine.helpers

	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
phcpresspro-2.1.0 app/controllers/phcpresspro/application_controller.rb
phcpresspro-2.0.1 app/controllers/phcpresspro/application_controller.rb