From 66094fdfdda1506bbad8fde2219c4b469efe64e5 Mon Sep 17 00:00:00 2001 From: Rimian Perkins Date: Wed, 5 Apr 2017 09:49:57 +1000 Subject: [PATCH] check for empty email --- app/controllers/discourse_donations/charges_controller.rb | 6 ++---- plugin.rb | 2 +- .../discourse_donations/charges_controller_spec.rb | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/controllers/discourse_donations/charges_controller.rb b/app/controllers/discourse_donations/charges_controller.rb index 308747b..f558cb4 100644 --- a/app/controllers/discourse_donations/charges_controller.rb +++ b/app/controllers/discourse_donations/charges_controller.rb @@ -7,10 +7,8 @@ module DiscourseDonations skip_before_filter :verify_authenticity_token, only: [:create] def create - if email.nil? - response = { - - } + if email.nil? || email.empty? + response = {} else Stripe.api_key = SiteSetting.discourse_donations_secret_key currency = SiteSetting.discourse_donations_currency diff --git a/plugin.rb b/plugin.rb index 2745f9e..c2acab6 100644 --- a/plugin.rb +++ b/plugin.rb @@ -1,6 +1,6 @@ # name: discourse-donations # about: Integrating Discourse with Stripe for donations -# version: 1.7.2 +# version: 1.7.3 # url: https://github.com/choiceaustralia/discourse-donations # authors: Rimian Perkins diff --git a/spec/controllers/discourse_donations/charges_controller_spec.rb b/spec/controllers/discourse_donations/charges_controller_spec.rb index 13b51d4..9d01873 100644 --- a/spec/controllers/discourse_donations/charges_controller_spec.rb +++ b/spec/controllers/discourse_donations/charges_controller_spec.rb @@ -15,7 +15,7 @@ module DiscourseDonations end it 'responds ok when the email is empty' do - post :create, { } + post :create, { email: '' } expect(response).to have_http_status(200) end