You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by ru...@apache.org on 2017/07/17 20:22:32 UTC

[whimsy] branch master updated: wire up the icla-invalid-id response

This is an automated email from the ASF dual-hosted git repository.

rubys 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 6d64097  wire up the icla-invalid-id response
6d64097 is described below

commit 6d6409756c67a95216ecf670ea7baded064bfcf4
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Mon Jul 17 16:22:18 2017 -0400

    wire up the icla-invalid-id response
---
 www/secretary/workbench/templates/icla-invalid-id.erb |  2 +-
 www/secretary/workbench/views/actions/icla.json.rb    | 12 ++++++++++--
 www/secretary/workbench/views/forms/icla.js.rb        | 13 ++++++++-----
 3 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/www/secretary/workbench/templates/icla-invalid-id.erb b/www/secretary/workbench/templates/icla-invalid-id.erb
index f88b12d..1093528 100644
--- a/www/secretary/workbench/templates/icla-invalid-id.erb
+++ b/www/secretary/workbench/templates/icla-invalid-id.erb
@@ -6,7 +6,7 @@ With this message, <%= @notify %> been notified that your ICLA has been filed.
 
 Please provide the PMC (copied) with a valid Apache id. The id must not already be in use. See http://http://people.apache.org/committer-index.html
 
-The id must contain at least three alphanumeric characters starting with an alphabetic character. No special characters.
+The id must contain at least three lowercase alphanumeric characters starting with an alphabetic character. No special characters.
 
 Warm Regards,
 
diff --git a/www/secretary/workbench/views/actions/icla.json.rb b/www/secretary/workbench/views/actions/icla.json.rb
index 1473728..c5f1165 100644
--- a/www/secretary/workbench/views/actions/icla.json.rb
+++ b/www/secretary/workbench/views/actions/icla.json.rb
@@ -27,6 +27,10 @@ _extract_project
 # obtain per-user information
 _personalize_email(env.user)
 
+# determine if the user id requested is valid and avaliable
+@valid_user = (@user =~ /^[a-z][a-z0-9]{2,}$/)
+@valid_user &&= !(ASF::ICLA.taken?(@user) or ASF::Mail.taken?(@user))
+
 ########################################################################
 #                            document/iclas                            #
 ########################################################################
@@ -112,7 +116,11 @@ end
 task "email #@email" do
   # chose reply based on whether or not the project/userid info was provided
   if @user and not @user.empty?
-    reply = 'icla-account-requested.erb'
+    if @valid_user
+      reply = 'icla-account-requested.erb'
+    else
+      reply = 'icla-invalid-id.erb'
+    end
   elsif @pmc
     @notify = "the #{@pmc.display_name} PMC has"
 
@@ -156,7 +164,7 @@ task "email #@email" do
   end
 end
 
-if @user and not @user.empty? and @pmc and not @votelink.empty?
+if @valid_user and @pmc and not @votelink.empty?
 
   ######################################################################
   #                   acreq/new-account-reqs.txt                       #
diff --git a/www/secretary/workbench/views/forms/icla.js.rb b/www/secretary/workbench/views/forms/icla.js.rb
index c4463bf..33fa486 100644
--- a/www/secretary/workbench/views/forms/icla.js.rb
+++ b/www/secretary/workbench/views/forms/icla.js.rb
@@ -114,11 +114,14 @@ class ICLA < React
       document.querySelector("input[name=#{name}]").validity.valid
     end
 
-    # new account request form
-    %w(user project votelink).each do |name|
-      input = document.querySelector("input[name=#{name}]")
-      input.required = @user && !@user.empty?
-      valid &= input.validity.valid
+    # new account request form - perform checks only if user is valid
+    user = document.querySelector("input[name=user]")
+    if user.value.length > 0 and user.validity.valid
+      %w(project votelink).each do |name|
+        input = document.querySelector("input[name=#{name}]")
+        input.required = @user && !@user.empty?
+        valid &= input.validity.valid
+      end
     end
 
     $file.disabled = !valid or @filed or @submitted

-- 
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].