diff --git a/app/controllers/devise/unlocks_controller.rb b/app/controllers/devise/unlocks_controller.rb index 125576ee..4d45e4b8 100644 --- a/app/controllers/devise/unlocks_controller.rb +++ b/app/controllers/devise/unlocks_controller.rb @@ -25,8 +25,7 @@ class Devise::UnlocksController < ApplicationController if resource.errors.empty? set_flash_message :notice, :unlocked if is_navigational_format? - sign_in(resource_name, resource) - respond_with_navigational(resource){ redirect_to after_sign_in_path_for(resource) } + respond_with_navigational(resource){ redirect_to new_session_path(resource) } else respond_with_navigational(resource.errors, :status => :unprocessable_entity){ render_with_scope :new } end diff --git a/test/integration/lockable_test.rb b/test/integration/lockable_test.rb index 631f8955..ed077156 100644 --- a/test/integration/lockable_test.rb +++ b/test/integration/lockable_test.rb @@ -80,16 +80,16 @@ class LockTest < ActionController::IntegrationTest visit_user_unlock_with_token(user.unlock_token) - assert_current_url '/' + assert_current_url "/users/sign_in" assert_contain 'Your account was successfully unlocked.' assert_not user.reload.access_locked? end - test "sign in user automatically after unlocking its account" do + test "redirect user to sign in page after unlocking its account" do user = create_user(:locked => true) visit_user_unlock_with_token(user.unlock_token) - assert warden.authenticated?(:user) + assert_not warden.authenticated?(:user) end test "user should not be able to sign in when locked" do