Class: Authorio::SessionsController
- Inherits:
-
AuthorioController
- Object
- ActionController::Base
- AuthorioController
- Authorio::SessionsController
- Defined in:
- app/controllers/authorio/sessions_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /session.
-
#destroy ⇒ Object
DELETE /session.
-
#new ⇒ Object
GET /session/new.
Methods inherited from AuthorioController
#authorized?, #current_user, #index, #logged_in?, #profile_url, #rememberable?, #user_scope_description, #user_session
Instance Method Details
#create ⇒ Object
POST /session
11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/controllers/authorio/sessions_controller.rb', line 11 def create user = User.find_by_username! auth_user_params[:username] raise Exceptions::InvalidPassword unless user.authenticate(auth_user_params[:password]) (user) if auth_user_params[:remember_me] # Even if we don't have a permanent remember-me session, we make a temporary session session[:user_id] = user.id redirect_to edit_user_path(user) rescue Exceptions::InvalidPassword redirect_back_with_error 'Incorrect password. Try again.' end |
#destroy ⇒ Object
DELETE /session
24 25 26 27 28 29 30 31 |
# File 'app/controllers/authorio/sessions_controller.rb', line 24 def destroy reset_session if ( = .encrypted[:user]) && (session = Session.()) .delete :user session.destroy end redirect_to new_session_path end |