From 31c3ab973fba5817a8cfaf25484e32793589cb78 Mon Sep 17 00:00:00 2001 From: Bilelkihal <61744974+Bilelkihal@users.noreply.github.com> Date: Fri, 10 Mar 2023 16:35:44 +0100 Subject: [PATCH 1/2] Add orcidId validation in the signup page --- app/controllers/users_controller.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index d0eaa7aaf4..117f7b448e 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -226,6 +226,9 @@ def validate(params) errors << "Please fill in the proper text from the supplied image" end end + if ((!params[:orcidId].match(/^\d{4}+(-\d{4})+$/)) || (params[:orcidId].length != 19)) && !(params[:orcidId].nil? || params[:orcidId].length < 1) + errors << "Please enter a valide orcid id" + end return errors end From 15058ac55b01c625d422216cc1143489ea814163 Mon Sep 17 00:00:00 2001 From: Bilelkihal <61744974+Bilelkihal@users.noreply.github.com> Date: Fri, 10 Mar 2023 16:36:13 +0100 Subject: [PATCH 2/2] Add the usename validation in the signup page --- app/controllers/users_controller.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 117f7b448e..319e2dc363 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -230,6 +230,9 @@ def validate(params) errors << "Please enter a valide orcid id" end + if params[:username].nil? || params[:username].length < 1 || !params[:username].match(/^[a-zA-Z0-9]([._-](?![._-])|[a-zA-Z0-9]){3,18}[a-zA-Z0-9]$/) + errors << "please enter a valid username" + end return errors end