VRFS-2540 : Don't send welcome email if recaptcha fails. Spec to verify.

This commit is contained in:
Steven Miers 2015-01-12 11:34:06 -06:00
parent 825a293c30
commit babd9d7d90
2 changed files with 6 additions and 9 deletions

View File

@ -1020,6 +1020,8 @@ module JamRuby
user.save
user.errors.add("recaptcha", "verification failed") if recaptcha_failed
if user.errors.any?
raise ActiveRecord::Rollback
else
@ -1036,16 +1038,9 @@ module JamRuby
UserMailer.confirm_email(user, signup_confirm_url.nil? ? nil : (signup_confirm_url + "/" + user.signup_token) ).deliver
end
end
if recaptcha_failed
user.errors.add "recaptcha", "verification failed"
raise ActiveRecord::Rollback
end
end
return user
end
user
end # def signup
# this is intended to be development-mode or test-mode only; VRFS-149
# it creates or updates one user per developer, so that we aren't in the business

View File

@ -666,6 +666,7 @@ describe UserManager do
before(:each) do
@old_recaptcha=Rails.application.config.recaptcha_enable
Rails.application.config.recaptcha_enable=true
UserMailer.deliveries.clear
end
after(:each) do
@ -687,6 +688,7 @@ describe UserManager do
signup_confirm_url: "http://localhost:3000/confirm")
user.errors.any?.should be_true
UserMailer.deliveries.should have(0).items
end
it "passes when facebook signup" do