Skip to content
Browse files

Attempt to fix #102

  • Loading branch information...
1 parent 473ef9c commit 17fc9b400861023964833da11fe39194625a65e8 @practicingruby practicingruby committed Nov 17, 2012
View
11 app/controllers/registration_controller.rb
@@ -45,13 +45,12 @@ def update_profile
def confirm_email
user = User.find_by_access_token(params[:secret])
- if user || current_user.try(:status) == "confirmed"
- user.clear_access_token
+ return redirect_to(:action => :index) unless user
- user.update_attribute(:status, "confirmed")
+ user.clear_access_token
+ user.update_attribute(:status, "confirmed")
- return redirect_to(:action => :payment)
- end
+ return redirect_to(:action => :payment)
end
def payment_pending
@@ -95,4 +94,4 @@ def ye_shall_not_pass
redirect_to root_path, :notice => "Your account is already setup."
end
end
-end
+end
View
10 test/integration/registration_test.rb
@@ -57,6 +57,16 @@ class RegistrationTest < ActionDispatch::IntegrationTest
end
end
+ test "attempting to confirm twice" do
+ simulated_user do
+ authenticate(:nickname => "TestUser", :uid => "12345")
+ create_profile(:email => "test@test.com")
+ confirmation_path = confirm_email
+ browser { visit confirmation_path } # this attempts to hit the secret URL again
+ make_payment
+ end
+ end
+
test "payment pending accounts" do
simulated_user do
register(Support::SimulatedUser.default)
View
1 test/support/simulated_user.rb
@@ -54,6 +54,7 @@ def confirm_email
browser do
visit registration_confirmation_path(:secret => secret)
+ return registration_confirmation_path(:secret => secret)
end
end

0 comments on commit 17fc9b4

Please sign in to comment.
Something went wrong with that request. Please try again.