Authentication fail with user cannot be serialized from session [#29]
This commit is contained in:
parent
9a4b374b96
commit
e6901686c4
|
@ -1,3 +1,9 @@
|
||||||
|
== 0.4.3
|
||||||
|
|
||||||
|
* bug fix
|
||||||
|
* [#29] Authentication fail if user cannot be serialized from session;
|
||||||
|
* Default configuration values should not overwrite user values;
|
||||||
|
|
||||||
== 0.4.2
|
== 0.4.2
|
||||||
|
|
||||||
* deprecations
|
* deprecations
|
||||||
|
|
2
Rakefile
2
Rakefile
|
@ -36,7 +36,7 @@ begin
|
||||||
s.description = "Flexible authentication solution for Rails with Warden"
|
s.description = "Flexible authentication solution for Rails with Warden"
|
||||||
s.authors = ['José Valim', 'Carlos Antônio']
|
s.authors = ['José Valim', 'Carlos Antônio']
|
||||||
s.files = FileList["[A-Z]*", "{app,config,generators,lib}/**/*", "init.rb"]
|
s.files = FileList["[A-Z]*", "{app,config,generators,lib}/**/*", "init.rb"]
|
||||||
s.add_dependency("warden", "~> 0.5.1")
|
s.add_dependency("warden", "~> 0.5.2")
|
||||||
end
|
end
|
||||||
|
|
||||||
Jeweler::GemcutterTasks.new
|
Jeweler::GemcutterTasks.new
|
||||||
|
|
|
@ -13,7 +13,7 @@ Warden::Manager.serialize_into_session{ |user| [user.class, user.id] }
|
||||||
# Session Serialization out. This block gets the user out of the session.
|
# Session Serialization out. This block gets the user out of the session.
|
||||||
# It should be the reverse of serializing the object into the session
|
# It should be the reverse of serializing the object into the session
|
||||||
Warden::Manager.serialize_from_session do |klass, id|
|
Warden::Manager.serialize_from_session do |klass, id|
|
||||||
klass.find(id)
|
klass.find_by_id(id)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Setup devise strategies for Warden
|
# Setup devise strategies for Warden
|
||||||
|
|
|
@ -184,4 +184,12 @@ class AuthenticationTest < ActionController::IntegrationTest
|
||||||
visit 'users/index'
|
visit 'users/index'
|
||||||
assert_equal "Cart", @controller.user_session[:cart]
|
assert_equal "Cart", @controller.user_session[:cart]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test 'destroyed account is logged out' do
|
||||||
|
sign_in_as_user
|
||||||
|
visit 'users/index'
|
||||||
|
User.destroy_all
|
||||||
|
visit 'users/index'
|
||||||
|
assert_redirected_to '/users/sign_in?unauthenticated=true'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue