plugins/SpecialAdmin.php
changeset 179 36b287f1d85c
parent 166 d53cc29308f4
child 187 9dbbec5e6096
equal deleted inserted replaced
178:4c19952406db 179:36b287f1d85c
   201     {
   201     {
   202       $strength = strval($strength);
   202       $strength = strval($strength);
   203       setConfig('pw_strength_minimum', $strength);
   203       setConfig('pw_strength_minimum', $strength);
   204     }
   204     }
   205     
   205     
       
   206     // Account lockout policy
       
   207     if ( preg_match('/^[0-9]+$/', $_POST['lockout_threshold']) )
       
   208       setConfig('lockout_threshold', $_POST['lockout_threshold']);
       
   209     
       
   210     if ( preg_match('/^[0-9]+$/', $_POST['lockout_duration']) )
       
   211       setConfig('lockout_duration', $_POST['lockout_duration']);
       
   212     
       
   213     if ( in_array($_POST['lockout_policy'], array('disable', 'captcha', 'lockout')) )
       
   214       setConfig('lockout_policy', $_POST['lockout_policy']);
       
   215     
   206     echo '<div class="info-box">Your changes to the site configuration have been saved.</div><br />';
   216     echo '<div class="info-box">Your changes to the site configuration have been saved.</div><br />';
   207     
   217     
   208   }
   218   }
   209   else if ( isset($_POST['submit']) && defined('ENANO_DEMO_MODE') )
   219   else if ( isset($_POST['submit']) && defined('ENANO_DEMO_MODE') )
   210   {
   220   {
   348           echo '<label><input'; if(getConfig('account_activation') == 'user') echo ' checked="checked"'; echo ' type="radio" name="account_activation" value="user" /> User</label>';
   358           echo '<label><input'; if(getConfig('account_activation') == 'user') echo ' checked="checked"'; echo ' type="radio" name="account_activation" value="user" /> User</label>';
   349           echo '<label><input'; if(getConfig('account_activation') == 'admin') echo ' checked="checked"'; echo ' type="radio" name="account_activation" value="admin" /> Admin</label>';
   359           echo '<label><input'; if(getConfig('account_activation') == 'admin') echo ' checked="checked"'; echo ' type="radio" name="account_activation" value="admin" /> Admin</label>';
   350           ?>
   360           ?>
   351         </td>
   361         </td>
   352       </tr>
   362       </tr>
       
   363       
       
   364     <!-- Account lockout -->
       
   365     
       
   366       <tr><th colspan="2">Account lockouts</th></tr>
       
   367       
       
   368       <tr><td class="row3" colspan="2">Configure Enano to prevent or restrict logins for a specified period of time if a user enters an incorrect password a specific number of times.</td></tr>
       
   369       
       
   370       <tr>
       
   371         <td class="row2">Lockout threshold:<br />
       
   372           <small>How many times can a user enter wrong credentials before a lockout goes into effect?</small>
       
   373         </td>
       
   374         <td class="row2">
       
   375           <input type="text" name="lockout_threshold" value="<?php echo ( $_ = getConfig('lockout_threshold') ) ? $_ : '5' ?>" />
       
   376         </td>
       
   377       </tr>
       
   378       
       
   379       <tr>
       
   380         <td class="row1">Lockout duration:<br />
       
   381           <small>This is how long an account lockout should last, in minutes.</small>
       
   382         </td>
       
   383         <td class="row1">
       
   384           <input type="text" name="lockout_duration" value="<?php echo ( $_ = getConfig('lockout_duration') ) ? $_ : '15' ?>" />
       
   385         </td>
       
   386       </tr>
       
   387       
       
   388       <tr>
       
   389         <td class="row2">Lockout policy:<br />
       
   390           <small>What should be done when a lockout goes into effect?</small>
       
   391         </td>
       
   392         <td class="row2">
       
   393           <label><input type="radio" name="lockout_policy" value="disable" <?php if ( getConfig('lockout_policy') == 'disable' ) echo 'checked="checked"'; ?> /> Don't do anything</label><br />
       
   394           <label><input type="radio" name="lockout_policy" value="captcha" <?php if ( getConfig('lockout_policy') == 'captcha' ) echo 'checked="checked"'; ?> /> Require visual confirmation</label><br />
       
   395           <label><input type="radio" name="lockout_policy" value="lockout" <?php if ( getConfig('lockout_policy') == 'lockout' || !getConfig('lockout_policy') ) echo 'checked="checked"'; ?> /> Prevent all login attempts</label>
       
   396         </td>
       
   397       </tr>
       
   398       
       
   399     <!-- Password strength -->
   353       
   400       
   354       <tr><th colspan="2">Password strength</th></tr>
   401       <tr><th colspan="2">Password strength</th></tr>
   355       
   402       
   356       <tr>
   403       <tr>
   357         <td class="row2">
   404         <td class="row2">
  2683               eval($fname.'();');
  2730               eval($fname.'();');
  2684             }
  2731             }
  2685           } 
  2732           } 
  2686           else 
  2733           else 
  2687           {
  2734           {
  2688             echo '<div class="wait-box">Please wait while the administration panel loads. You need to be using a recent browser with AJAX support in order to use Runt.</div>';
  2735             echo '<script type="text/javascript">document.write(\'<div class="wait-box">Please wait while the administration panel loads. You need to be using a recent browser with AJAX support in order to use Runt.</div>\');</script><noscript><div class="error-box">It looks like Javascript isn\'t enabled in your browser. Please enable Javascript or use a different browser to continue.</div></noscript>';
  2689           }
  2736           }
  2690           ?>
  2737           ?>
  2691           </div>
  2738           </div>
  2692           <script type="text/javascript">
  2739           <script type="text/javascript">
  2693             if ( KILL_SWITCH )
  2740             if ( KILL_SWITCH )