whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [whimsy] branch master updated: Don't create the JSON file if validation fails
Date Thu, 05 Jul 2018 23:42:03 GMT
This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new eef163e  Don't create the JSON file if validation fails
eef163e is described below

commit eef163e10e0386bd494a63965bb420a3c25f4111
Author: Sebb <sebb@apache.org>
AuthorDate: Fri Jul 6 00:42:02 2018 +0100

    Don't create the JSON file if validation fails
---
 www/project/icla/views/actions/discuss.json.rb | 12 +++++++++---
 www/project/icla/views/actions/vote.json.rb    | 13 +++++++++----
 2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/www/project/icla/views/actions/discuss.json.rb b/www/project/icla/views/actions/discuss.json.rb
index 5f26860..ad72b0d 100644
--- a/www/project/icla/views/actions/discuss.json.rb
+++ b/www/project/icla/views/actions/discuss.json.rb
@@ -38,16 +38,21 @@ user = ASF::Person.find(env.user)
 user_email = user.id + '@apache.org'
 subject = params['subject']
 
+if ASF::Person.find_by_email(@iclaemail)
+  _error "ICLA already on file for #{@iclaemail}"
+  _focus :iclaemail
+  return # cannot continue
+end
+
 begin
   Socket.getaddrinfo(@iclaemail[/@(.*)/, 1].untaint, 'smtp')
 
-  if ASF::Person.find_by_email(@iclaemail)
-    _error "ICLA already on file for #{@iclaemail}"
-  end
 rescue
   _error 'Invalid domain name in email address'
   _focus :iclaemail
+  return # cannot continue
 end
+
 # create the discussion object
 timestamp = Time.now.utc.to_s
 date = timestamp[0..9] # keep only the date 
@@ -80,6 +85,7 @@ if err
   else
     _error err.inspect
   end
+  return # cannot continue
 end
 
 # add user and pmc emails to the response
diff --git a/www/project/icla/views/actions/vote.json.rb b/www/project/icla/views/actions/vote.json.rb
index a68cc91..c7e55c1 100644
--- a/www/project/icla/views/actions/vote.json.rb
+++ b/www/project/icla/views/actions/vote.json.rb
@@ -38,16 +38,20 @@ user = ASF::Person.find(env.user)
 user_email = user.id + '@apache.org'
 subject = params['subject']
 
+if ASF::Person.find_by_email(@iclaemail)
+  _error "ICLA already on file for #{@iclaemail}"
+  _focus :iclaemail
+  return # cannot continue
+end
+
 begin
   Socket.getaddrinfo(@iclaemail[/@(.*)/, 1].untaint, 'smtp')
-
-  if ASF::Person.find_by_email(@iclaemail)
-    _error "ICLA already on file for #{@iclaemail}"
-  end
 rescue
   _error 'Invalid domain name in email address'
   _focus :iclaemail
+  return # cannot continue
 end
+
 # create the vote object
 timestamp = Time.now.utc.to_s # need HMS in order to calculate accurate elapsed times
 date = timestamp[0..9] # keep only the date 
@@ -80,6 +84,7 @@ if err
   else
     _error err.inspect
   end
+  return # cannot continue
 end
 
 


Mime
View raw message