Module: EasyAuth::Controllers::Sessions

Extended by:
ReverseConcern
Included in:
SessionsController
Defined in:
lib/easy_auth/controllers/sessions.rb

Instance Method Summary collapse

Methods included from ReverseConcern

append_features, extended, reverse_included

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object (private)



74
75
76
77
78
79
# File 'lib/easy_auth/controllers/sessions.rb', line 74

def method_missing(method_name, *args)
  # Swallow exceptions for identity callbacks
  unless method_name.to_s =~ /after_\w+_with_\w+/
    super
  end
end

Instance Method Details

#createObject



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/easy_auth/controllers/sessions.rb', line 8

def create
  if identity = EasyAuth.authenticate(self)
    identity.(session)
    set_remember(identity)
    if identity.remember
      cookies[:remember_token] = { :value => identity.generate_remember_token!, :expires => identity.remember_time.from_now }
    end
    (identity)
  else
    @identity = EasyAuth.find_identity_model(params).new(params[params[:identity]])
    (@identity)
  end
end

#destroyObject



22
23
24
25
26
27
# File 'lib/easy_auth/controllers/sessions.rb', line 22

def destroy
  session.delete(:session_token)
  session.delete(:account_class)
  cookies.delete(:remember_token)
  after_sign_out
end

#newObject



4
5
6
# File 'lib/easy_auth/controllers/sessions.rb', line 4

def new
  EasyAuth.new_session(self)
end