Browse Source

Merge pull request #26 from rossta/bug_fix_store_location

ensure return_to location is properly stored
master
Dmitrii Golub 11 years ago
parent
commit
d72374618d
  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