Sha256: 9bc2581b60573456b967242ec65e012f10d1a5a57dfdaba12e677de5ea48d8e9

Contents?: true

Size: 661 Bytes

Versions: 42

Compression:

Stored size: 661 Bytes

Contents

module Edgarj
  module AuthenticationMixin
    def self.included(klass)
      klass.helper_method :current_user
    end

  private
    def access_denied
      flash.now[:error] = v('login_failed')
     #redirect_to login_path
      respond_to do |format|
        format.html {
          render '/edgarj/sssns/new', layout: 'login'
        }
        format.js {
          render '/edgarj/sssns/new'
        }
      end
    end

    # before_filter to enforce a login requirement.
    def require_login
      !!current_user || access_denied
    end

    def current_user
      @current_user ||= User.find(session[:user_id]) if session[:user_id]
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
edgarj-4.06.10 app/controllers/edgarj/authentication_mixin.rb.sample
edgarj-4.06.09 app/controllers/edgarj/authentication_mixin.rb.sample
edgarj-4.06.07 app/controllers/edgarj/authentication_mixin.rb.sample
edgarj-4.06.05 app/controllers/edgarj/authentication_mixin.rb.sample
edgarj-4.06.04 app/controllers/edgarj/authentication_mixin.rb.sample
edgarj-4.06.03 app/controllers/edgarj/authentication_mixin.rb.sample
edgarj-4.06.02 app/controllers/edgarj/authentication_mixin.rb.sample
edgarj-4.06.01 app/controllers/edgarj/authentication_mixin.rb.sample
edgarj-4.06.00 app/controllers/edgarj/authentication_mixin.rb.sample
edgarj-4.05.04 app/controllers/edgarj/authentication_mixin.rb.sample
edgarj-4.05.03 app/controllers/edgarj/authentication_mixin.rb.sample
edgarj-4.05.02 app/controllers/edgarj/authentication_mixin.rb.sample
edgarj-4.05.01 app/controllers/edgarj/authentication_mixin.rb.sample
edgarj-4.05.00 app/controllers/edgarj/authentication_mixin.rb.sample
edgarj-4.04.01 app/controllers/edgarj/authentication_mixin.rb.sample
edgarj-4.04.00 app/controllers/edgarj/authentication_mixin.rb.sample
edgarj-4.03.00 app/controllers/edgarj/authentication_mixin.rb.sample
edgarj-4.02.00 app/controllers/edgarj/authentication_mixin.rb.sample
edgarj-4.01.01 app/controllers/edgarj/authentication_mixin.rb.sample
edgarj-4.01.00 app/controllers/edgarj/authentication_mixin.rb.sample