plugins/SpecialUserFuncs.php
changeset 688 f2a824ce5f18
parent 685 17ebe24cdf85
child 701 dd80cde96a6c
equal deleted inserted replaced
687:ea43ac1ff2ee 688:f2a824ce5f18
   347            </tr>
   347            </tr>
   348            <?php
   348            <?php
   349          }
   349          }
   350          ?>
   350          ?>
   351          <?php
   351          <?php
       
   352          if ( $level <= USER_LEVEL_MEMBER )
       
   353          {
       
   354            // "remember me" switch
       
   355            // first order of business is to determine what the checkbox should say
       
   356            $session_time = intval(getConfig('session_remember_time', '30'));
       
   357            if ( $session_time === 0 )
       
   358            {
       
   359              // sessions are infinite
       
   360              $text_remember = $lang->get('user_login_check_remember_infinite');
       
   361            }
       
   362            else
       
   363            {
       
   364              // is the number of days evenly divisible by 7? if so, use weeks
       
   365              if ( $session_time % 7 == 0 )
       
   366              {
       
   367                $session_time = $session_time / 7;
       
   368                $unit = 'week';
       
   369              }
       
   370              else
       
   371              {
       
   372                $unit = 'day';
       
   373              }
       
   374              // if it's not equal to 1, pluralize it
       
   375              if ( $session_time != 1 )
       
   376              {
       
   377                $unit .= 's';
       
   378              }
       
   379              $text_remember = $lang->get('user_login_check_remember', array(
       
   380                  'session_length' => $session_time,
       
   381                  'length_units' => $lang->get("etc_unit_$unit")
       
   382                ));
       
   383            }
       
   384            ?>
       
   385            <tr>
       
   386              <td class="row2">
       
   387                <?php echo $lang->get('user_login_field_remember'); ?>
       
   388              </td>
       
   389              <td class="row1" colspan="2">
       
   390                <label>
       
   391                  <input type="checkbox" name="remember" tabindex="3" />
       
   392                  <?php echo $text_remember; ?>
       
   393                </label>
       
   394              </td>
       
   395            </tr>
       
   396            <?php
       
   397          }
   352          if ( $level <= USER_LEVEL_MEMBER && ( !isset($_GET['use_crypt']) || ( isset($_GET['use_crypt']) && $_GET['use_crypt']!='0' ) ) )
   398          if ( $level <= USER_LEVEL_MEMBER && ( !isset($_GET['use_crypt']) || ( isset($_GET['use_crypt']) && $_GET['use_crypt']!='0' ) ) )
   353          {
   399          {
   354            echo '<tr>
   400            echo '<tr>
   355              <td class="row3" colspan="3">';
   401              <td class="row3" colspan="3">';
   356              
   402              
   384            echo '</tr>';
   430            echo '</tr>';
   385          }
   431          }
   386          ?>
   432          ?>
   387          
   433          
   388          <tr>
   434          <tr>
   389            <th colspan="3" style="text-align: center" class="subhead"><input type="submit" name="login" value="Log in" tabindex="<?php echo ( $level <= USER_LEVEL_MEMBER ) ? '3' : '2'; ?>" /></th>
   435            <th colspan="3" style="text-align: center" class="subhead"><input type="submit" name="login" value="Log in" tabindex="<?php echo ( $level <= USER_LEVEL_MEMBER ) ? '4' : '2'; ?>" /></th>
   390          </tr>
   436          </tr>
   391       </table>
   437       </table>
   392     </div>
   438     </div>
   393       <input type="hidden" name="challenge_data" value="<?php echo $challenge; ?>" />
   439       <input type="hidden" name="challenge_data" value="<?php echo $challenge; ?>" />
   394       <input type="hidden" name="use_crypt" value="no" />
   440       <input type="hidden" name="use_crypt" value="no" />
   477   {
   523   {
   478     $captcha_hash = ( isset($_POST['captcha_hash']) ) ? $_POST['captcha_hash'] : false;
   524     $captcha_hash = ( isset($_POST['captcha_hash']) ) ? $_POST['captcha_hash'] : false;
   479     $captcha_code = ( isset($_POST['captcha_code']) ) ? $_POST['captcha_code'] : false;
   525     $captcha_code = ( isset($_POST['captcha_code']) ) ? $_POST['captcha_code'] : false;
   480     if ( $_POST['use_crypt'] == 'yes' )
   526     if ( $_POST['use_crypt'] == 'yes' )
   481     {
   527     {
   482       $result = $session->login_with_crypto($_POST['username'], $_POST['crypt_data'], $_POST['crypt_key'], $_POST['challenge_data'], intval($_POST['auth_level']), $captcha_hash, $captcha_code);
   528       $result = $session->login_with_crypto($_POST['username'], $_POST['crypt_data'], $_POST['crypt_key'], $_POST['challenge_data'], intval($_POST['auth_level']), $captcha_hash, $captcha_code, isset($_POST['remember']));
   483     }
   529     }
   484     else if ( $_POST['use_crypt'] == 'yes_dh' )
   530     else if ( $_POST['use_crypt'] == 'yes_dh' )
   485     {
   531     {
   486       // retrieve and decrypt the password using DiffieHellman
   532       // retrieve and decrypt the password using DiffieHellman
   487       
   533       
   549       // decrypt user info
   595       // decrypt user info
   550       $aes_key = hexdecode($aes_key);
   596       $aes_key = hexdecode($aes_key);
   551       $aes = AESCrypt::singleton(AES_BITS, AES_BLOCKSIZE);
   597       $aes = AESCrypt::singleton(AES_BITS, AES_BLOCKSIZE);
   552       $password = $aes->decrypt($_POST['crypt_data'], $aes_key, ENC_HEX);
   598       $password = $aes->decrypt($_POST['crypt_data'], $aes_key, ENC_HEX);
   553       
   599       
   554       $result = $session->login_without_crypto($_POST['username'], $password, false, intval($_POST['auth_level']), $captcha_hash, $captcha_code);
   600       $result = $session->login_without_crypto($_POST['username'], $password, false, intval($_POST['auth_level']), $captcha_hash, $captcha_code, isset($_POST['remember']));
   555     }
   601     }
   556     else
   602     else
   557     {
   603     {
   558       $result = $session->login_without_crypto($_POST['username'], $_POST['pass'], false, intval($_POST['auth_level']), $captcha_hash, $captcha_code);
   604       $result = $session->login_without_crypto($_POST['username'], $_POST['pass'], false, intval($_POST['auth_level']), $captcha_hash, $captcha_code, isset($_POST['remember']));
   559     }
   605     }
   560    
   606    
   561     if($result['success'])
   607     if($result['success'])
   562     {
   608     {
   563       $session->start();
   609       $session->start();