mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Add fragment support for store_location_for
This commit is contained in:
parent
d67388ad98
commit
5dedd8c4cf
2 changed files with 8 additions and 1 deletions
|
@ -35,7 +35,9 @@ module Devise
|
||||||
session_key = stored_location_key_for(resource_or_scope)
|
session_key = stored_location_key_for(resource_or_scope)
|
||||||
uri = parse_uri(location)
|
uri = parse_uri(location)
|
||||||
if uri
|
if uri
|
||||||
session[session_key] = [uri.path.sub(/\A\/+/, '/'), uri.query].compact.join('?')
|
path = [uri.path.sub(/\A\/+/, '/'), uri.query].compact.join('?')
|
||||||
|
path = [path, uri.fragment].compact.join('#')
|
||||||
|
session[session_key] = path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -245,6 +245,11 @@ class ControllerAuthenticatableTest < ActionController::TestCase
|
||||||
assert_equal "/foo?bar=baz", @controller.stored_location_for(:user)
|
assert_equal "/foo?bar=baz", @controller.stored_location_for(:user)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test 'store location for stores fragments' do
|
||||||
|
@controller.store_location_for(:user, "/foo#bar")
|
||||||
|
assert_equal "/foo#bar", @controller.stored_location_for(:user)
|
||||||
|
end
|
||||||
|
|
||||||
test 'after sign in path defaults to root path if none by was specified for the given scope' do
|
test 'after sign in path defaults to root path if none by was specified for the given scope' do
|
||||||
assert_equal root_path, @controller.after_sign_in_path_for(:user)
|
assert_equal root_path, @controller.after_sign_in_path_for(:user)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue