includes/clientside/static/login.js
changeset 471 7906fb190fc1
parent 461 717e71109645
child 472 bc4b58034f4d
equal deleted inserted replaced
470:a044ad834691 471:7906fb190fc1
   108       setTimeout(function() {
   108       setTimeout(function() {
   109           var d = document.getElementById('autoCaptcha');
   109           var d = document.getElementById('autoCaptcha');
   110           d.parentNode.removeChild(d);
   110           d.parentNode.removeChild(d);
   111         }, to);
   111         }, to);
   112     }
   112     }
       
   113     // Ask the server to clean our key
       
   114     ajaxLoginPerformRequest({
       
   115         mode: 'clean_key',
       
   116         key_aes: logindata.key_aes,
       
   117         key_dh: logindata.key_dh
       
   118     });
   113   };
   119   };
   114   
   120   
   115   logindata.mb_object.onbeforeclick['OK'] = function()
   121   logindata.mb_object.onbeforeclick['OK'] = function()
   116   {
   122   {
   117     ajaxLoginSubmitForm();
   123     ajaxLoginSubmitForm();
   323   {
   329   {
   324     logindata.mb_object.destroy();
   330     logindata.mb_object.destroy();
   325     new messagebox(MB_ICONSTOP | MB_OK, 'FIXME L10N: There was an error in the login process', 'The following error code came from the server:<br />' + response.error);
   331     new messagebox(MB_ICONSTOP | MB_OK, 'FIXME L10N: There was an error in the login process', 'The following error code came from the server:<br />' + response.error);
   326     return false;
   332     return false;
   327   }
   333   }
   328   // Rid ourselves of any loading windows
       
   329   ajaxLoginSetStatus(AJAX_STATUS_DESTROY);
       
   330   // Main mode switch
   334   // Main mode switch
   331   switch ( response.mode )
   335   switch ( response.mode )
   332   {
   336   {
   333     case 'build_box':
   337     case 'build_box':
       
   338       // Rid ourselves of any loading windows
       
   339       ajaxLoginSetStatus(AJAX_STATUS_DESTROY);
   334       // The server wants us to build the login form, all the information is there
   340       // The server wants us to build the login form, all the information is there
   335       ajaxLoginBuildForm(response);
   341       ajaxLoginBuildForm(response);
   336       break;
   342       break;
   337     case 'login_success':
   343     case 'login_success':
   338       ajaxLoginSetStatus(AJAX_STATUS_SUCCESS);
   344       ajaxLoginSetStatus(AJAX_STATUS_SUCCESS);
   339       logindata.successfunc(response.key);
   345       logindata.successfunc(response.key);
   340       break;
   346       break;
   341     case 'login_failure':
   347     case 'login_failure':
       
   348       // Rid ourselves of any loading windows
       
   349       ajaxLoginSetStatus(AJAX_STATUS_DESTROY);
   342       document.getElementById('messageBox').style.backgroundColor = '#C0C0C0';
   350       document.getElementById('messageBox').style.backgroundColor = '#C0C0C0';
   343       var mb_parent = document.getElementById('messageBox').parentNode;
   351       var mb_parent = document.getElementById('messageBox').parentNode;
   344       new Spry.Effect.Shake(mb_parent, {duration: 1500}).start();
   352       new Spry.Effect.Shake(mb_parent, {duration: 1500}).start();
   345       setTimeout(function()
   353       setTimeout(function()
   346         {
   354         {
   347           document.getElementById('messageBox').style.backgroundColor = '#FFF';
   355           document.getElementById('messageBox').style.backgroundColor = '#FFF';
   348           ajaxLoginBuildForm(response.respawn_info);
   356           ajaxLoginBuildForm(response.respawn_info);
   349           ajaxLoginShowFriendlyError(response);
   357           ajaxLoginShowFriendlyError(response);
   350         }, 2500);
   358         }, 2500);
       
   359       break;
       
   360     case 'noop':
   351       break;
   361       break;
   352   }
   362   }
   353 }
   363 }
   354 
   364 
   355 /*
   365 /*