Module: Auth1::SessionsHelper
- Defined in:
- app/helpers/auth1/sessions_helper.rb
Instance Method Summary collapse
- #login_button(name = 'Login', options = nil, html_options = nil, &block) ⇒ Object
- #login_link(name = 'Login', options = nil, html_options = nil, &block) ⇒ Object
- #login_or_logout_button(name = %w[Login Logout],, options = [nil, nil], html_options = [nil, nil], &block) ⇒ Object
- #login_or_logout_link(name = %w[Login Logout],, options = [nil, nil], html_options = [nil, nil], &block) ⇒ Object
- #logout_button(name = 'Logout', options = nil, html_options = nil, &block) ⇒ Object
- #logout_link(name = 'Logout', options = nil, html_options = nil, &block) ⇒ Object
- #user_signed_in? ⇒ Boolean
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', = nil, = nil, &block) ||= '/auth/auth0' ||= {} [:method] = :post (name, , , &block) end |
#login_link(name = 'Login', options = nil, html_options = nil, &block) ⇒ Object
31 32 33 34 35 36 |
# File 'app/helpers/auth1/sessions_helper.rb', line 31 def login_link(name = 'Login', = nil, = nil, &block) ||= '/auth/auth0' ||= {} [:method] = :post link_to(name, , , &block) 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], = [nil, nil], = [nil, nil], &block) if user_signed_in? = [1] || {} [:method] = :get (name[1], [1], , &block) else = [0] || {} [:method] = :post (name[0], [0], , &block) end end |
#login_or_logout_link(name = %w[Login Logout],, options = [nil, nil], html_options = [nil, nil], &block) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 |
# File 'app/helpers/auth1/sessions_helper.rb', line 45 def login_or_logout_link(name = %w[Login Logout], = [nil, nil], = [nil, nil], &block) if user_signed_in? = [1] || {} [:method] = :get logout_link(name[1], [1], , &block) else = [0] || {} [:method] = :post login_link(name[0], [0], , &block) end 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 (name = 'Logout', = nil, = nil, &block) ||= auth1.logout_path ||= {} [:method] = :get (name, , , &block) end |
#logout_link(name = 'Logout', options = nil, html_options = nil, &block) ⇒ Object
38 39 40 41 42 43 |
# File 'app/helpers/auth1/sessions_helper.rb', line 38 def logout_link(name = 'Logout', = nil, = nil, &block) ||= auth1.logout_path ||= {} [:method] = :get link_to(name, , , &block) end |
#user_signed_in? ⇒ Boolean
57 58 59 |
# File 'app/helpers/auth1/sessions_helper.rb', line 57 def user_signed_in? session['userinfo'].present? end |