Sha256: fc2fa14b194e807600bc2896f904c4b5a7a3990cfb15e10097b9fa251ae21d7b
Contents?: true
Size: 1.32 KB
Versions: 11
Compression:
Stored size: 1.32 KB
Contents
module Vidibus module User module Extensions # Contains extensions of ApplicationController. module Controller extend ActiveSupport::Concern included do helper_method :warden, :signed_in?, :user_signed_in?, :current_user, :user_session end protected # Accessor for the warden proxy instance. def warden request.env["warden"] end # Performs login on Connector service. def authenticate_user! return if user_signed_in? store_location warden.authenticate!(:scope => :user) end # Returns session of currently signed in user. def user_session current_user and warden.session(:user) end # Returns user currently logged in. def current_user warden.user(:user) end # Returns true if user is logged in. def user_signed_in? warden.authenticated?(:user) end alias_method :signed_in?, :user_signed_in? private # Stores current location in session to perform redirect after signin in session def store_location Rails.logger.error 'store_location: '+request.fullpath session[:user_return_to] = request.fullpath end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems