[Vtigercrm-commits] [vtiger-commits] r10601 - in /vtigercrm/branches/5.0.3: Smarty/templates/UserEditView.tpl include/js/general.js

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Mon Apr 9 12:04:07 EDT 2007


Author: richie
Date: Mon Apr  9 10:03:59 2007
New Revision: 10601

Log:
* Denied special characters in user creation, Fixed #3625

Modified:
    vtigercrm/branches/5.0.3/Smarty/templates/UserEditView.tpl
    vtigercrm/branches/5.0.3/include/js/general.js

Modified: vtigercrm/branches/5.0.3/Smarty/templates/UserEditView.tpl
==============================================================================
--- vtigercrm/branches/5.0.3/Smarty/templates/UserEditView.tpl (original)
+++ vtigercrm/branches/5.0.3/Smarty/templates/UserEditView.tpl Mon Apr  9 10:03:59 2007
@@ -32,6 +32,9 @@
 function check_duplicate()
 {ldelim}
 	var user_name = window.document.EditView.user_name.value;
+	var status = usernameValid(user_name);
+        if(status)
+	{ldelim}
 	new Ajax.Request(
                 'index.php',
                 {ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
@@ -45,7 +48,9 @@
                         {rdelim}
                 {rdelim}
         );
-
+	{rdelim}
+	else
+            alert("Please Enter Character & Numerical Values");
 {rdelim}
 
 </script>

Modified: vtigercrm/branches/5.0.3/include/js/general.js
==============================================================================
--- vtigercrm/branches/5.0.3/include/js/general.js (original)
+++ vtigercrm/branches/5.0.3/include/js/general.js Mon Apr  9 10:03:59 2007
@@ -2008,3 +2008,18 @@
             document.location.href=url;
        }
 }
+
+function usernameCharValid(c) {
+  return ( ((c >= 'a') && (c <= 'z')) ||
+           ((c >= 'A') && (c <= 'Z')) ||
+           ((c >= '0') && (c <= '9')) ||
+           (c == '.') );
+}
+
+function usernameValid(s) {
+  for (var i = 0; i < s.length; i++) {
+    if (!usernameCharValid(s.charAt(i))){
+      return false;}
+  }
+  return true;
+}





More information about the vtigercrm-commits mailing list