summaryrefslogtreecommitdiff
path: root/users/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'users/app/controllers')
-rw-r--r--users/app/controllers/controller_extension/authentication.rb4
-rw-r--r--users/app/controllers/sessions_controller.rb6
2 files changed, 4 insertions, 6 deletions
diff --git a/users/app/controllers/controller_extension/authentication.rb b/users/app/controllers/controller_extension/authentication.rb
index 0408b77..87f7921 100644
--- a/users/app/controllers/controller_extension/authentication.rb
+++ b/users/app/controllers/controller_extension/authentication.rb
@@ -7,8 +7,8 @@ module ControllerExtension::Authentication
helper_method :current_user, :logged_in?, :admin?
end
- def current_user
- @current_user ||= request.env['warden'].user
+ def authentication_error
+ warden.winning_strategy.try(:message)
end
def logged_in?
diff --git a/users/app/controllers/sessions_controller.rb b/users/app/controllers/sessions_controller.rb
index 06d55eb..722265a 100644
--- a/users/app/controllers/sessions_controller.rb
+++ b/users/app/controllers/sessions_controller.rb
@@ -3,9 +3,7 @@ class SessionsController < ApplicationController
skip_before_filter :verify_authenticity_token
def new
- if warden.winning_strategy
- @errors = warden.winning_strategy.message
- end
+ @errors = authentication_error
end
def create
@@ -17,7 +15,7 @@ class SessionsController < ApplicationController
end
def destroy
- session[:user_id] = nil
+ logout
redirect_to root_path
end
end