Browse Source

ensure return_to location is properly stored

fixes small typo in session key for what Devise expects when retrieving
stored return_to path for a given scope
master
Ross Kaffenberger 11 years ago
parent
commit
bb1a619a3c
  1. 2
      lib/two_factor_authentication/controllers/helpers.rb
  2. 6
      spec/rails_app/app/controllers/home_controller.rb

2
lib/two_factor_authentication/controllers/helpers.rb

@ -21,7 +21,7 @@ module TwoFactorAuthentication
def handle_failed_second_factor(scope)
if request.format.present? and request.format.html?
session["#{scope}_return_tor"] = request.path if request.get?
session["#{scope}_return_to"] = request.path if request.get?
redirect_to two_factor_authentication_path_for(scope)
else
render nothing: true, status: :unauthorized

6
spec/rails_app/app/controllers/home_controller.rb

@ -1,5 +1,4 @@
class HomeController < ApplicationController
prepend_before_filter :store_location, only: :dashboard
before_filter :authenticate_user!, only: :dashboard
def index
@ -8,9 +7,4 @@ class HomeController < ApplicationController
def dashboard
end
private
def store_location
store_location_for(:user, dashboard_path)
end
end

Loading…
Cancel
Save