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"> |