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) def handle_failed_second_factor(scope)
if request.format.present? and request.format.html? 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) redirect_to two_factor_authentication_path_for(scope)
else else
render nothing: true, status: :unauthorized render nothing: true, status: :unauthorized

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

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

Loading…
Cancel
Save