Module: EasyAuth::Controllers::Sessions

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

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object



71
72
73
74
75
76
# File 'lib/easy_auth/controllers/sessions.rb', line 71

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

#after_failed_sign_inObject



36
37
38
# File 'lib/easy_auth/controllers/sessions.rb', line 36

def 
  after_with_or_default(__method__)
end

#after_failed_sign_in_defaultObject



48
49
50
51
# File 'lib/easy_auth/controllers/sessions.rb', line 48

def 
  flash.now[:error] = I18n.t('easy_auth.sessions.create.error')
  render :new
end

#after_sign_outObject



53
54
55
# File 'lib/easy_auth/controllers/sessions.rb', line 53

def after_sign_out
  redirect_to after_sign_out_url, :notice => I18n.t('easy_auth.sessions.delete.notice')
end

#after_sign_out_urlObject



57
58
59
# File 'lib/easy_auth/controllers/sessions.rb', line 57

def after_sign_out_url
  main_app.root_url
end

#after_successful_sign_inObject



28
29
30
# File 'lib/easy_auth/controllers/sessions.rb', line 28

def 
  after_with_or_default(__method__)
end

#after_successful_sign_in_defaultObject



40
41
42
# File 'lib/easy_auth/controllers/sessions.rb', line 40

def 
  redirect_to(session.delete(:requested_path) || , :notice => I18n.t('easy_auth.sessions.create.notice'))
end

#after_successful_sign_in_urlObject



32
33
34
# File 'lib/easy_auth/controllers/sessions.rb', line 32

def 
  after_with_or_default(__method__)
end

#after_successful_sign_in_url_defaultObject



44
45
46
# File 'lib/easy_auth/controllers/sessions.rb', line 44

def 
  @identity.
end

#after_with_or_default(method_name) ⇒ Object



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

def after_with_or_default(method_name)
  send("#{method_name}_with_#{params[:identity]}") || send("#{method_name}_default")
end

#createObject



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

def create
  if @identity = EasyAuth.authenticate(self)
    session[:identity_id] = @identity.id
    
  else
    @identity = EasyAuth.find_identity_model(params).new(params[params[:identity]])
    
  end
rescue AbstractController::DoubleRenderError
end

#destroyObject



19
20
21
22
# File 'lib/easy_auth/controllers/sessions.rb', line 19

def destroy
  session.delete(:identity_id)
  after_sign_out
end

#newObject



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

def new
  EasyAuth.new_session(self)
end

#no_authenticationObject



61
62
63
64
65
# File 'lib/easy_auth/controllers/sessions.rb', line 61

def no_authentication
  if 
    redirect_to no_authentication_url
  end
end

#no_authentication_urlObject



67
68
69
# File 'lib/easy_auth/controllers/sessions.rb', line 67

def no_authentication_url
  main_app.root_url
end