includes/clientside/static/login.js
changeset 1075 f4b89aa4226d
parent 1070 617366710de2
child 1076 9c364fded738
equal deleted inserted replaced
1074:1a4f13626f76 1075:f4b89aa4226d
   618   }
   618   }
   619   
   619   
   620   // Done building the main part of the form
   620   // Done building the main part of the form
   621   form.appendChild(table);
   621   form.appendChild(table);
   622   
   622   
       
   623   // Checkbox container
       
   624   var boxen = document.createElement('div');
       
   625   boxen.style.textAlign = 'center';
       
   626   boxen.style.padding = '7px 0';
       
   627   
   623   // Field: remember login
   628   // Field: remember login
   624   if ( logindata.user_level <= USER_LEVEL_MEMBER )
   629   if ( logindata.user_level <= USER_LEVEL_MEMBER )
   625   {
   630   {
   626     var lbl_remember = document.createElement('label');
   631     var lbl_remember = document.createElement('label');
   627     lbl_remember.style.fontSize = 'smaller';
   632     lbl_remember.style.fontSize = 'smaller';
   628     lbl_remember.style.display = 'block';
       
   629     lbl_remember.style.textAlign = 'center';
   633     lbl_remember.style.textAlign = 'center';
   630     
   634     
   631     // figure out what text to put in the "remember me" checkbox
   635     // figure out what text to put in the "remember me" checkbox
   632     // infinite session length?
   636     // infinite session length?
   633     if ( data.extended_time == 0 )
   637     if ( data.extended_time == 0 )
   668       check_remember.setAttribute('checked', 'checked');
   672       check_remember.setAttribute('checked', 'checked');
   669     check_remember.id = 'ajax_login_field_remember';
   673     check_remember.id = 'ajax_login_field_remember';
   670     lbl_remember.appendChild(check_remember);
   674     lbl_remember.appendChild(check_remember);
   671     lbl_remember.innerHTML += ' ' + txt_remember;
   675     lbl_remember.innerHTML += ' ' + txt_remember;
   672     
   676     
   673     form.appendChild(lbl_remember);
   677     boxen.appendChild(lbl_remember);
   674   }
   678   }
       
   679   
       
   680   var bullet = document.createElement('span');
       
   681   bullet.innerHTML = '&nbsp;';
       
   682   bullet.style.fontSize = '12pt';
       
   683   bullet.style.borderRight = '1px solid #aaa';
       
   684   bullet.style.margin = '0 6px 0 4px';
   675   
   685   
   676   // Field: enable Diffie Hellman
   686   // Field: enable Diffie Hellman
   677   if ( ajax_login_prevent_dh )
   687   if ( ajax_login_prevent_dh )
   678   {
   688   {
       
   689     boxen.appendChild(bullet);
   679     var lbl_dh = document.createElement('span');
   690     var lbl_dh = document.createElement('span');
   680     lbl_dh.style.fontSize = 'smaller';
   691     lbl_dh.style.fontSize = 'smaller';
   681     lbl_dh.style.display = 'block';
       
   682     lbl_dh.style.textAlign = 'center';
   692     lbl_dh.style.textAlign = 'center';
   683     lbl_dh.innerHTML = $lang.get('user_login_ajax_check_dh_ie');
   693     lbl_dh.innerHTML = $lang.get('user_login_ajax_check_dh_ie');
   684     form.appendChild(lbl_dh);
   694     boxen.appendChild(lbl_dh);
   685   }
   695   }
   686   else if ( !data.allow_diffiehellman )
   696   else if ( !data.allow_diffiehellman )
   687   {
   697   {
   688     // create hidden control - server requested that DiffieHellman be disabled (usually means not supported)
   698     // create hidden control - server requested that DiffieHellman be disabled (usually means not supported)
   689     var check_dh = document.createElement('input');
   699     var check_dh = document.createElement('input');
   690     check_dh.type = 'hidden';
   700     check_dh.type = 'hidden';
   691     check_dh.id = 'ajax_login_field_dh';
   701     check_dh.id = 'ajax_login_field_dh';
   692     form.appendChild(check_dh);
   702     boxen.appendChild(check_dh);
   693   }
   703   }
   694   else
   704   else
   695   {
   705   {
       
   706     boxen.appendChild(bullet);
       
   707     
   696     var lbl_dh = document.createElement('label');
   708     var lbl_dh = document.createElement('label');
   697     lbl_dh.style.fontSize = 'smaller';
   709     lbl_dh.style.fontSize = 'smaller';
   698     lbl_dh.style.display = 'block';
       
   699     lbl_dh.style.textAlign = 'center';
   710     lbl_dh.style.textAlign = 'center';
   700     var check_dh = document.createElement('input');
   711     var check_dh = document.createElement('input');
   701     check_dh.type = 'checkbox';
   712     check_dh.type = 'checkbox';
   702     // this onclick attribute changes the cookie whenever the checkbox or label is clicked
   713     // this onclick attribute changes the cookie whenever the checkbox or label is clicked
   703     check_dh.setAttribute('onclick', 'var ck = ( this.checked ) ? "enable" : "disable"; createCookie("diffiehellman_login", ck, 3650);');
   714     check_dh.setAttribute('onclick', 'var ck = ( this.checked ) ? "enable" : "disable"; createCookie("diffiehellman_login", ck, 3650);');
   704     if ( readCookie('diffiehellman_login') != 'disable' )
   715     if ( readCookie('diffiehellman_login') != 'disable' )
   705       check_dh.setAttribute('checked', 'checked');
   716       check_dh.setAttribute('checked', 'checked');
   706     check_dh.id = 'ajax_login_field_dh';
   717     check_dh.id = 'ajax_login_field_dh';
   707     lbl_dh.appendChild(check_dh);
   718     lbl_dh.appendChild(check_dh);
   708     lbl_dh.innerHTML += ' ' + $lang.get('user_login_ajax_check_dh');
   719     lbl_dh.innerHTML += ' ' + $lang.get('user_login_ajax_check_dh');
   709     form.appendChild(lbl_dh);
   720     boxen.appendChild(lbl_dh);
   710   }
   721   }
       
   722   
       
   723   form.appendChild(boxen);
   711   
   724   
   712   if ( IE )
   725   if ( IE )
   713   {
   726   {
   714     div.innerHTML += form.outerHTML;
   727     div.innerHTML += form.outerHTML;
   715   }
   728   }
   720   
   733   
   721   // Diagnostic / help links
   734   // Diagnostic / help links
   722   // (only displayed in login, not in re-auth)
   735   // (only displayed in login, not in re-auth)
   723   if ( logindata.user_level == USER_LEVEL_MEMBER )
   736   if ( logindata.user_level == USER_LEVEL_MEMBER )
   724   {
   737   {
   725     form.style.marginBottom = '10px';
       
   726     var links = document.createElement('small');
   738     var links = document.createElement('small');
   727     links.style.display = 'block';
   739     links.style.display = 'block';
   728     links.style.textAlign = 'center';
   740     links.style.textAlign = 'center';
   729     links.innerHTML = '';
   741     links.innerHTML = '';
   730     if ( !show_captcha )
   742     if ( !show_captcha )
   731       links.innerHTML += $lang.get('user_login_ajax_link_fullform', { link_full_form: makeUrlNS('Special', 'Login/' + title) }) + '<br />';
   743       links.innerHTML += $lang.get('user_login_ajax_link_fullform', { link_full_form: makeUrlNS('Special', 'Login/' + title) }) + ' &bull; ';
   732     // Always shown
   744     // Always shown
   733     links.innerHTML += $lang.get('user_login_ajax_link_forgotpass', { forgotpass_link: makeUrlNS('Special', 'PasswordReset') }) + '<br />';
   745     links.innerHTML += $lang.get('user_login_ajax_link_forgotpass', { forgotpass_link: makeUrlNS('Special', 'PasswordReset') }) + ' &bull; ';
   734     if ( !show_captcha )
   746     if ( !show_captcha )
   735       links.innerHTML += $lang.get('user_login_createaccount_blurb', { reg_link: makeUrlNS('Special', 'Register') });
   747       links.innerHTML += $lang.get('user_login_ajax_createaccount_blurb', { reg_link: makeUrlNS('Special', 'Register') });
   736     div.appendChild(links);
   748     div.appendChild(links);
   737   }
   749   }
   738   
   750   
   739   // Insert the entire form into the login window
   751   // Insert the entire form into the login window
   740   logindata.mb_inner.innerHTML = '';
   752   logindata.mb_inner.innerHTML = '';