plugins/SpecialUserFuncs.php
changeset 614 78d1e71dc720
parent 604 6a90893622f0
child 621 68f8a9cc0a18
equal deleted inserted replaced
613:c08670a77871 614:78d1e71dc720
   930         <input type="hidden" name="use_crypt" value="no" />
   930         <input type="hidden" name="use_crypt" value="no" />
   931         <input type="hidden" name="crypt_key" value="<?php echo $pubkey; ?>" />
   931         <input type="hidden" name="crypt_key" value="<?php echo $pubkey; ?>" />
   932         <input type="hidden" name="crypt_data" value="" />
   932         <input type="hidden" name="crypt_data" value="" />
   933       <script type="text/javascript">
   933       <script type="text/javascript">
   934         // ENCRYPTION CODE
   934         // ENCRYPTION CODE
   935         disableJSONExts();
       
   936         str = '';
       
   937         for(i=0;i<keySizeInBits/4;i++) str+='0';
       
   938         var key = hexToByteArray(str);
       
   939         var pt = hexToByteArray(str);
       
   940         var ct = rijndaelEncrypt(pt, key, "ECB");
       
   941         var ct = byteArrayToHex(ct);
       
   942         switch(keySizeInBits)
       
   943         {
       
   944           case 128:
       
   945             v = '66e94bd4ef8a2c3b884cfa59ca342b2e';
       
   946             break;
       
   947           case 192:
       
   948             v = 'aae06992acbf52a3e8f4a96ec9300bd7aae06992acbf52a3e8f4a96ec9300bd7';
       
   949             break;
       
   950           case 256:
       
   951             v = 'dc95c078a2408989ad48a21492842087dc95c078a2408989ad48a21492842087';
       
   952             break;
       
   953         }
       
   954         var aes_testpassed = ( ct == v && md5_vm_test() );
       
   955         function runEncryption()
   935         function runEncryption()
   956         {
   936         {
   957           var frm = document.forms.regform;
   937           var frm = document.forms.regform;
   958           if ( frm.password.value.length < 1 )
   938           if ( frm.password.value.length < 1 )
   959             return true;
   939             return true;
   967           if ( pass1.length < 6 && pass1.length > 0 )
   947           if ( pass1.length < 6 && pass1.length > 0 )
   968           {
   948           {
   969             alert($lang.get('user_reg_err_alert_password_tooshort'));
   949             alert($lang.get('user_reg_err_alert_password_tooshort'));
   970             return false;
   950             return false;
   971           }
   951           }
   972           if(aes_testpassed)
   952           if(aes_self_test())
   973           {
   953           {
   974             frm.use_crypt.value = 'yes';
   954             frm.use_crypt.value = 'yes';
   975             var cryptkey = frm.crypt_key.value;
   955             var cryptkey = frm.crypt_key.value;
   976             frm.crypt_key.value = hex_md5(cryptkey);
   956             frm.crypt_key.value = hex_md5(cryptkey);
   977             cryptkey = hexToByteArray(cryptkey);
   957             cryptkey = hexToByteArray(cryptkey);
  1122           {
  1102           {
  1123             var frm = document.forms.regform;
  1103             var frm = document.forms.regform;
  1124             document.getElementById('captchaimg').src = '<?php echo makeUrlNS("Special", "Captcha/$captchacode"); ?>/'+Math.floor(Math.random() * 100000);
  1104             document.getElementById('captchaimg').src = '<?php echo makeUrlNS("Special", "Captcha/$captchacode"); ?>/'+Math.floor(Math.random() * 100000);
  1125             return false;
  1105             return false;
  1126           }
  1106           }
  1127           <?php if ( getConfig('pw_strength_enable') == '1' ): ?>
  1107           addOnloadHook(function()
  1128           var frm = document.forms.regform;
  1108             {
  1129           password_score_field(frm.password);
  1109               <?php if ( getConfig('pw_strength_enable') == '1' ): ?>
  1130           <?php endif; ?>
  1110               var frm = document.forms.regform;
  1131           validateForm();
  1111               load_component('pwstrength');
  1132           setTimeout('checkUsername();', 1000);
  1112               password_score_field(frm.password);
       
  1113               <?php endif; ?>
       
  1114               load_component('crypto');
       
  1115               validateForm();
       
  1116               setTimeout('checkUsername();', 1000);
       
  1117             });
  1133           // ]]>
  1118           // ]]>
  1134         </script>
  1119         </script>
  1135       </enano:no-opt>
  1120       </enano:no-opt>
  1136     <?php
  1121     <?php
  1137   }
  1122   }