includes/clientside/static/misc.js
changeset 348 87e08a6e4fec
parent 340 993fb077944f
child 372 5bd429428101
--- a/includes/clientside/static/misc.js	Thu Jan 03 18:39:19 2008 -0500
+++ b/includes/clientside/static/misc.js	Wed Jan 16 13:55:49 2008 -0500
@@ -565,32 +565,8 @@
   
   disableJSONExts();
   
-  //
-  // Encryption test
-  //
+  var auth_enabled = aes_self_test();
   
-  var str = '';
-  for(i=0;i<keySizeInBits/4;i++)
-  {
-    str+='0';
-  }
-  str = hexToByteArray(str);
-  var ct  = rijndaelEncrypt(str, str, 'ECB');
-  ct      = byteArrayToHex(ct);
-  var v;
-  switch(keySizeInBits)
-  {
-    case 128:
-      v = '66e94bd4ef8a2c3b884cfa59ca342b2e';
-      break;
-    case 192:
-      v = 'aae06992acbf52a3e8f4a96ec9300bd7aae06992acbf52a3e8f4a96ec9300bd7';
-      break;
-    case 256:
-      v = 'dc95c078a2408989ad48a21492842087dc95c078a2408989ad48a21492842087';
-      break;
-  }
-  auth_enabled = ( ct == v && md5_vm_test() );
   if ( !auth_enabled )
   {
     alert('Login error: encryption sanity check failed\n');
@@ -796,6 +772,18 @@
 }
 
 /**
+ * Validates a username.
+ * @param string Username to test
+ * @return bool
+ */
+
+function validateUsername(username)
+{
+  var regex = new RegExp('^[^<>&\?\'"%\n\r/]+$', '');
+  return ( username.match(regex) ) ? true : false;
+}
+
+/**
  * Equivalent of PHP's time()
  * @return int
  */