Skip to content

Commit

Permalink
redirect users to sign in page after unlock, closes #1486
Browse files Browse the repository at this point in the history
  • Loading branch information
nashby committed Dec 8, 2011
1 parent 263e0b7 commit 1e1e964
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions app/controllers/devise/unlocks_controller.rb
Expand Up @@ -25,8 +25,7 @@ def show

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
Expand Down
6 changes: 3 additions & 3 deletions test/integration/lockable_test.rb
Expand Up @@ -80,16 +80,16 @@ def send_unlock_request

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
Expand Down

0 comments on commit 1e1e964

Please sign in to comment.