Module: Edgar::AuthenticationMixin

Defined in:
app/controllers/edgar/authentication_mixin.rb

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Object) included(klass)



3
4
5
# File 'app/controllers/edgar/authentication_mixin.rb', line 3

def self.included(klass)
  klass.helper_method :current_user
end

Instance Method Details

- (Object) access_denied (private)



8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/edgar/authentication_mixin.rb', line 8

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

- (Object) current_user (private)



26
27
28
# File 'app/controllers/edgar/authentication_mixin.rb', line 26

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

- (Object) require_login (private)

before_filter to enforce a login requirement.



22
23
24
# File 'app/controllers/edgar/authentication_mixin.rb', line 22

def 
  !!current_user || access_denied
end