Module: Auth1::SessionsHelper

Defined in:
app/helpers/auth1/sessions_helper.rb

Instance Method Summary collapse

Instance Method Details

#login_button(name = 'Login', options = nil, html_options = nil, &block) ⇒ Object



5
6
7
8
9
10
# File 'app/helpers/auth1/sessions_helper.rb', line 5

def (name = 'Login', options = nil, html_options = nil, &block)
  options ||= '/auth/auth0'
  html_options ||= {}
  html_options[:method] = :post
  button_to(name, options, html_options, &block)
end


31
# File 'app/helpers/auth1/sessions_helper.rb', line 31

def ; end

#login_or_logout_button(name = %w[Login Logout],, options = [nil, nil], html_options = [nil, nil], &block) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'app/helpers/auth1/sessions_helper.rb', line 19

def (name = %w[Login Logout], options = [nil, nil], html_options = [nil, nil], &block)
  if user_signed_in?
    logout_html_options = html_options[1] || {}
    logout_html_options[:method] = :get
    logout_button(name[1], options[1], logout_html_options, &block)
  else
     = html_options[0] || {}
    [:method] = :post
    (name[0], options[0], , &block)
  end
end


35
# File 'app/helpers/auth1/sessions_helper.rb', line 35

def ; end

#logout_button(name = 'Logout', options = nil, html_options = nil, &block) ⇒ Object



12
13
14
15
16
17
# File 'app/helpers/auth1/sessions_helper.rb', line 12

def logout_button(name = 'Logout', options = nil, html_options = nil, &block)
  options ||= auth1.logout_path
  html_options ||= {}
  html_options[:method] = :get
  button_to(name, options, html_options, &block)
end


33
# File 'app/helpers/auth1/sessions_helper.rb', line 33

def logout_link; end

#user_signed_in? ⇒ Boolean

Returns:

  • (Boolean)


37
38
39
# File 'app/helpers/auth1/sessions_helper.rb', line 37

def user_signed_in?
  session['userinfo'].present?
end