Module: Authem::Controller::SessionManagementMethods
- Defined in:
- lib/authem/controller.rb
Instance Method Summary collapse
- #clear_all_sessions_for(model, **options) ⇒ Object
- #redirect_back_or_to(url, **options) ⇒ Object
- #sign_in(model, **options) ⇒ Object
- #sign_out(model, **options) ⇒ Object
Instance Method Details
#clear_all_sessions_for(model, **options) ⇒ Object
21 22 23 24 |
# File 'lib/authem/controller.rb', line 21 def clear_all_sessions_for(model, **) role = .fetch(:as){ self.class.authem_role_for(model) } public_send "clear_all_#{role}_sessions_for", model end |
#redirect_back_or_to(url, **options) ⇒ Object
26 27 28 29 |
# File 'lib/authem/controller.rb', line 26 def redirect_back_or_to(url, **) url = session.delete(:return_to_url) || url redirect_to url, end |
#sign_in(model, **options) ⇒ Object
11 12 13 14 |
# File 'lib/authem/controller.rb', line 11 def sign_in(model, **) role = .fetch(:as){ self.class.authem_role_for(model) } public_send "sign_in_#{role}", model, end |
#sign_out(model, **options) ⇒ Object
16 17 18 19 |
# File 'lib/authem/controller.rb', line 16 def sign_out(model, **) role = .fetch(:as){ self.class.authem_role_for(model) } public_send "sign_out_#{role}" end |