plugins/yubikey/admincp.php
changeset 8 032ca892b9a2
parent 0 9d2c4f04a0d0
child 27 647f0aa485dd
equal deleted inserted replaced
7:c8fc1493eacd 8:032ca892b9a2
    59       <td class="row1">
    59       <td class="row1">
    60         <input type="text" name="yubikey_enroll_limit" value="<?php echo strval(intval(getConfig('yubikey_enroll_limit', '3'))); ?>" size="5" />
    60         <input type="text" name="yubikey_enroll_limit" value="<?php echo strval(intval(getConfig('yubikey_enroll_limit', '3'))); ?>" size="5" />
    61       </td>
    61       </td>
    62     </tr>
    62     </tr>
    63     
    63     
       
    64     <tr>
       
    65       <td class="row2">
       
    66         <?php echo $lang->get('yubiacp_field_reg_require_otp_title'); ?><br />
       
    67         <small><?php echo $lang->get('yubiacp_field_reg_require_otp_hint'); ?></small>
       
    68       </td>
       
    69       <td class="row2">
       
    70         <label>
       
    71           <input type="checkbox" name="yubikey_reg_require_otp" <?php if ( getConfig('yubikey_reg_require_otp', '0') == '1' ) echo 'checked="checked" '; ?>/>
       
    72           <?php echo $lang->get('yubiacp_field_reg_require_otp'); ?>
       
    73         </label>
       
    74       </td>
       
    75     </tr>
       
    76     
    64   <?php
    77   <?php
    65 }
    78 }
    66 
    79 
    67 function yubikey_admin_cp_save()
    80 function yubikey_admin_cp_save()
    68 {
    81 {
    71   // yubikey_enable, yubikey_api_key, yubikey_api_key_id, yubikey_auth_server, yubikey_enroll_limit
    84   // yubikey_enable, yubikey_api_key, yubikey_api_key_id, yubikey_auth_server, yubikey_enroll_limit
    72   setConfig('yubikey_enable', isset($_POST['yubikey_enable']) ? '1' : '0');
    85   setConfig('yubikey_enable', isset($_POST['yubikey_enable']) ? '1' : '0');
    73   setConfig('yubikey_api_key', $_POST['yubikey_api_key']);
    86   setConfig('yubikey_api_key', $_POST['yubikey_api_key']);
    74   setConfig('yubikey_api_key_id', intval($_POST['yubikey_api_key_id']));
    87   setConfig('yubikey_api_key_id', intval($_POST['yubikey_api_key_id']));
    75   setConfig('yubikey_enroll_limit', intval($_POST['yubikey_enroll_limit']));
    88   setConfig('yubikey_enroll_limit', intval($_POST['yubikey_enroll_limit']));
       
    89   setConfig('yubikey_reg_require_otp', isset($_POST['yubikey_reg_require_otp']) ? '1' : '0');
    76   
    90   
    77   if ( preg_match('#^(?:https?://)?(\[?[a-z0-9-:]+(?:\.[a-z0-9-:]+\]?)*)(/.*)$#', $_POST['yubikey_auth_server']) )
    91   if ( preg_match('#^(?:https?://)?(\[?[a-z0-9-:]+(?:\.[a-z0-9-:]+\]?)*)(/.*)$#', $_POST['yubikey_auth_server']) )
    78     setConfig('yubikey_auth_server', $_POST['yubikey_auth_server']);
    92     setConfig('yubikey_auth_server', $_POST['yubikey_auth_server']);
    79   else
    93   else
    80     echo '<div class="error-box">' . $lang->get('yubiacp_err_invalid_auth_server') . '</div>';
    94     echo '<div class="error-box">' . $lang->get('yubiacp_err_invalid_auth_server') . '</div>';