includes/clientside/static/misc.js
changeset 174 4c5c2b66a34d
parent 144 380e55865f86
child 175 1465f48faba0
equal deleted inserted replaced
170:250aeb408ed7 174:4c5c2b66a34d
   299  */
   299  */
   300 
   300 
   301 var ajax_auth_prompt_cache = false;
   301 var ajax_auth_prompt_cache = false;
   302 var ajax_auth_mb_cache = false;
   302 var ajax_auth_mb_cache = false;
   303 var ajax_auth_level_cache = false;
   303 var ajax_auth_level_cache = false;
       
   304 var ajax_auth_error_string = false;
   304 
   305 
   305 function ajaxPromptAdminAuth(call_on_ok, level)
   306 function ajaxPromptAdminAuth(call_on_ok, level)
   306 {
   307 {
   307   if ( typeof(call_on_ok) == 'function' )
   308   if ( typeof(call_on_ok) == 'function' )
   308   {
   309   {
   334           return false;
   335           return false;
   335         }
   336         }
   336         response = parseJSON(response);
   337         response = parseJSON(response);
   337         var level = ajax_auth_level_cache;
   338         var level = ajax_auth_level_cache;
   338         var form_html = '';
   339         var form_html = '';
   339         if ( level > USER_LEVEL_MEMBER )
   340         if ( ajax_auth_error_string )
       
   341         {
       
   342           form_html += '<span style="color: #D84308;">' + ajax_auth_error_string + '</span><br /><br />';
       
   343           ajax_auth_error_string = false;
       
   344         }
       
   345         else if ( level > USER_LEVEL_MEMBER )
   340         {
   346         {
   341           form_html += 'Please re-enter your login details, to verify your identity.<br /><br />';
   347           form_html += 'Please re-enter your login details, to verify your identity.<br /><br />';
   342         }
   348         }
   343         form_html += ' \
   349         form_html += ' \
   344           <table border="0" align="center"> \
   350           <table border="0" align="center"> \
   486             {
   492             {
   487               ajaxAuthLoginInnerSetup();
   493               ajaxAuthLoginInnerSetup();
   488             }
   494             }
   489             break;
   495             break;
   490           case 'error':
   496           case 'error':
   491             alert(response.error);
   497             if ( response.error == 'The username and/or password is incorrect.' )
   492             ajaxAuthLoginInnerSetup();
   498             {
       
   499               ajax_auth_error_string = response.error;
       
   500               mb_current_obj.updateContent('');
       
   501               document.getElementById('messageBox').style.backgroundColor = '#C0C0C0';
       
   502               new Spry.Effect.Shake('messageBox', {duration: 1500}).start();
       
   503               new Spry.Effect.Shake('messageBoxButtons', {duration: 1500}).start();
       
   504               setTimeout("document.getElementById('messageBox').style.backgroundColor = '#FFF'; ajaxAuthLoginInnerSetup();", 2500);
       
   505             }
       
   506             else
       
   507             {
       
   508               alert(response.error);
       
   509               ajaxAuthLoginInnerSetup();
       
   510             }
   493             break;
   511             break;
   494           default:
   512           default:
   495             alert(ajax.responseText);
   513             alert(ajax.responseText);
   496             break;
   514             break;
   497         }
   515         }