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
19 20 21 22 |
# File 'lib/authem/controller.rb', line 19 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
24 25 26 27 |
# File 'lib/authem/controller.rb', line 24 def redirect_back_or_to(url, ={}) url = session.delete(:return_to_url) || url redirect_to url, end |
#sign_in(model, options = {}) ⇒ Object
8 9 10 11 12 |
# File 'lib/authem/controller.rb', line 8 def sign_in(model, ={}) role = .fetch(:as){ self.class.authem_role_for(model) } session.delete :_csrf_token if session.respond_to?(:delete) public_send "sign_in_#{role}", model, end |
#sign_out(model, options = {}) ⇒ Object
14 15 16 17 |
# File 'lib/authem/controller.rb', line 14 def sign_out(model, ={}) role = .fetch(:as){ self.class.authem_role_for(model) } public_send "sign_out_#{role}" end |