Exemple #1
0
$form_fields = new crf_basic_fields();
$crf_theme = $form_fields->crf_get_global_option_value('crf_theme');
wp_enqueue_style('crf-style-default', plugin_dir_url(__FILE__) . 'css/crf-style-' . $crf_theme . '.css');
$enable_captcha = $form_fields->crf_get_global_option_value('enable_captcha');
$publickey = $form_fields->crf_get_global_option_value('public_key');
$privatekey = $form_fields->crf_get_global_option_value('private_key');
if ($enable_captcha == 'yes' && get_option('ucf_enable_captcha_login', 'no') == 'yes') {
    if (isset($_POST['g-recaptcha-response'])) {
        require_once 'autoload.php';
        $recaptcha = new \ReCaptcha\ReCaptcha($privatekey, new \ReCaptcha\RequestMethod\CurlPost());
        $resp = $recaptcha->verify($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']);
        if ($resp->isSuccess()) {
            $submit = 1;
        } else {
            $errors = $resp->getErrorCodes();
            $form_fields->crf_field_captcha_error($errors);
            $submit = 0;
        }
    }
} else {
    $submit = 1;
}
if (isset($_POST['submit']) && $submit == 1) {
    $retrieved_nonce = $_REQUEST['_wpnonce'];
    if (!wp_verify_nonce($retrieved_nonce, 'view_crf_login_form')) {
        die('Failed security check');
    }
    crf_user_authentication($_POST['user_login'], $_POST['user_pass'], $_POST['rememberme']);
}
function crf_user_authentication($username, $password, $remember)
{