includes/clientside/static/login.js
changeset 843 4415e50e4e84
parent 824 28d9fbcd4f0d
child 883 ac2cef868fa9
--- a/includes/clientside/static/login.js	Thu Feb 26 01:06:58 2009 -0500
+++ b/includes/clientside/static/login.js	Thu Feb 26 01:07:32 2009 -0500
@@ -347,6 +347,10 @@
       
       break;
       
+    default:
+      eval(setHook('login_set_status'));
+      break;
+      
     case AJAX_STATUS_DESTROY:
     case null:
     case undefined:
@@ -556,6 +560,8 @@
   tr2.appendChild(td2_2);
   table.appendChild(tr2);
   
+  eval(setHook('login_build_form'));
+  
   // Field - captcha
   if ( show_captcha )
   {
@@ -806,11 +812,11 @@
     }
   }
   
-  if ( !username )
+  if ( typeof(username) != 'string' )
   {
     var username = document.getElementById('ajax_login_field_username').value;
   }
-  if ( !password )
+  if ( typeof(password) != 'string' )
   {
     var password = document.getElementById('ajax_login_field_password').value;
   }
@@ -851,10 +857,14 @@
   ajaxLoginSetStatus(AJAX_STATUS_LOGGING_IN);
   
   // Encrypt the password and username
-  var userinfo = toJSONString({
+  var userinfo = {
       username: username,
       password: password
-    });
+    };
+    
+  eval(setHook('login_build_userinfo'));
+    
+  userinfo = toJSONString(userinfo);
   var crypt_key_ba = hexToByteArray(crypt_key);
   userinfo = stringToByteArray(userinfo);
   
@@ -957,10 +967,18 @@
 
 window.ajaxLoginGetErrorText = function(response)
 {
+  if ( !response.error_code.match(/^[a-z0-9]+_[a-z0-9_]+$/) )
+  {
+    return response.error_code;
+  }
   switch ( response.error_code )
   {
     default:
-      return $lang.get('user_err_' + response.error_code);
+      var ls = $lang.get('user_err_' + response.error_code);
+      if ( ls == 'user_err_' + response.error_code )
+        ls = $lang.get(response.error_code);
+      
+      return ls;
       break;
     case 'locked_out':
       if ( response.respawn_info.lockout_info.lockout_policy == 'lockout' )
@@ -1005,13 +1023,18 @@
         switch ( response.respawn_info.lockout_info.lockout_policy )
         {
           case 'captcha':
-            base += $lang.get('user_err_invalid_credentials_lockout', { 
+            base += $lang.get('user_err_invalid_credentials_lockout_captcha', { 
                 fails: response.respawn_info.lockout_info.lockout_fails,
                 lockout_threshold: response.respawn_info.lockout_info.lockout_threshold,
                 lockout_duration: response.respawn_info.lockout_info.lockout_duration
               });
             break;
           case 'lockout':
+            base += $lang.get('user_err_invalid_credentials_lockout', { 
+                fails: response.respawn_info.lockout_info.lockout_fails,
+                lockout_threshold: response.respawn_info.lockout_info.lockout_threshold,
+                lockout_duration: response.respawn_info.lockout_info.lockout_duration
+              });
             break;
         }
       }