Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/controllers/devise/confirmations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ def create

# GET /resource/confirmation?confirmation_token=abcdef
def show
return head :ok if request.head?

self.resource = resource_class.confirm_by_token(params[:confirmation_token])
yield resource if block_given?

Expand Down
9 changes: 9 additions & 0 deletions test/integration/confirmable_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@ def resend_confirmation
end
end

test 'HEAD request should not confirm an account' do
user = create_user(confirm: false)

head user_confirmation_path(confirmation_token: user.raw_confirmation_token)

assert_response :ok
assert_not user.reload.confirmed?
end

test 'user should be redirected to a custom path after confirmation' do
Devise::ConfirmationsController.any_instance.stubs(:after_confirmation_path_for).returns("/?custom=1")

Expand Down