reCaptcha V2 (Box "I'm not a robot.") - Page Contact

DeCysos

Phoenix Foto Service
Beta tester
▶🚶‍Reproduction steps
  1. Go to Dashboard > Settings > External services and enable reCAPTCHA - Version 2, threshold 2, Force reCAPTCHA on contact page = YES
  2. Go to Cloudflare and enable "Development Mode" & chose "Purge Cache"
  3. In the browser settings (Firefox or Chrome) empty the cache and cookies.
  4. Go to youre Page to contact (https://pfs.red/page/kontakt). Check reCaptcha (click) (not more), Done.
  5. Go to loginpage (https://pfs.red/login) - Log in to your account.
  6. Go to contactpage (https://pfs.red/page/kontakt). Attempt to tick reCaptcha.
😢Unexpected result

Where you put the hook for the reCaptcha, a loading icon (see picture) is displayed and it lasts about 10-15 seconds.
No error message is output, only the unactivated reCaptcha window is displayed.

📃Error log message

No error log available regarding this event


----------------
in German language
----------------
▶🚶‍ Reproduktionsschritte
  1. Gehen Sie zu Dashboard> Einstellungen> Externe Dienste und aktivieren Sie reCAPTCHA - Version 2, Schwellenwert 2, reCAPTCHA auf Kontaktseite erzwingen = JA
  2. Gehe zu Cloudflare und aktiviere "Entwicklungsmodus" und wähle "Cache leeren"
  3. In den Browsereinstellungen (Firefox oder Chrome) den Cache und die Cookies löschen/leeren.
  4. Gehen Sie zu Ihrer Kontaktseite (https://pfs.red/page/kontakt). Überprüfe (anklicken) reCaptcha (nicht mehr), fertig.
  5. Gehen Sie zur Anmeldeseite (https://pfs.red/login) - Melden Sie sich bei Ihrem Konto an.
  6. Gehen Sie zur Kontaktseite (https://pfs.red/page/kontakt). Versuchen Sie, reCaptcha anzukreuzen.
😢 Unerwartetes Ergebnis

Dort wo man den Haken für das reCaptcha setzt, wird ein Ladeicon (siehe Bild) angezeigt und es läd ungefair 10-15 Sekunden.
Es wird keine Fehlermeldung ausgegeben, nur das nicht aktivierte reCaptcha-Fenster wird angezeigt.



📃 Fehlerprotokollmeldung

Kein Fehlerprotokoll vorhanden bezüglich dieses Ereignisses
 

Attachments

DeCysos

Phoenix Foto Service
Beta tester
My contactpage....
kontakt.php
PHP:
<?php if (!defined('access') or !access) {
    die('This file cannot be directly accessed.');
} ?>
<?php
$is_error = false;
$input_errors = [];

$allowed_subjects = [
    'general' => _s('General questions/comments'),
    'dmca' => _s('DMCA complaint'),
    'userregister' => _s('userregister'),
    'asuggestion' => _s('Make a suggestion'),
    'sitefunction' => _s('Function of this Page'),
    'requestfsk18' => _s('Request special release (FSK)'),
    'imagedelete' => _s('Deletion of a picture'),
];

if (is_captcha_needed() || (CHV\getSetting('recaptcha') && CHV\getSetting('force_recaptcha_contact_page'))) {
    G\Handler::setCond('captcha_show', true);
    G\Handler::setVar(...CHV\Render\get_recaptcha_component());
}

if ($_POST) {
    if (!G\Handler::checkAuthToken($_REQUEST['auth_token'])) {
        die(_s("Request denied"));
    }

    // Validate post data
    if(strlen($_POST['name']) == 0) {
        $input_errors['name'] = _s('Invalid name');
    }
    if(strlen($_POST['message']) == 0) {
        $input_errors['message'] = _s('Invalid message');
    }
    if(!array_key_exists($_POST['subject'], $allowed_subjects)) {
        $input_errors['subject'] = _s('Invalid subject');
    }
    if(!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
        $input_errors['email'] = _s('Invalid email');
    }
    if (G\Handler::getCond('captcha_show')) {
        $captcha = CHV\recaptcha_check();
        if (!$captcha->is_valid) {
            $input_errors['recaptcha'] = _s('%s says you are a robot', 'reCAPTCHA');
        }
    }

    if(count($input_errors) > 0) {
        $is_error = true;
    } else {
        $email        = trim($_POST['email']);
        $subject    = CHV\getSettings()['website_name'] . ' Kontaktformular';
        $name        = $_POST['name'];
        $send_mail = [
            'to'         => CHV\getSettings()['email_incoming_email'],
            'from'         => [CHV\getSettings()['email_from_email'], $name . ' (' . CHV\getSettings()['website_name'] . ' Kontaktformular)'],
            'reply-to'    => [$email]
        ];
        $body_arr    = [ // Mail body array (easier to edit)
            'Name'        => $name,
            'E-Mail'    => $email,
            'Benutzer'        => (CHV\Login::isLoggedUser() ? CHV\Login::getUser()['url'] : 'not user'),
            'Betreff'    => $_POST['subject'] . "\n",
            'Nachricht'    => strip_tags($_POST['message']) . "\n",
            'IP'        => G\get_client_ip(),
            'Browser'    => getenv("HTTP_USER_AGENT"),
            'URL'        => G\get_base_url() . "\n"
        ];
        // Format body message
        $body = '';
        foreach($body_arr as $k => $v) {
            $body .= $k . ': ' . $v . "\n";
        }
        // Mail send handle
        try {
            CHV\send_mail($send_mail, $subject, $body);
            $is_sent = true;
        } catch(Exception $e) {
            $is_error = true;
            $error = _s('Mail error') . ': ' . $e->getMessage();
        }
    }
}

G\Render\include_theme_header(); ?>

<div class="content-width">
    <div class="c24 center-box">
        <div class="header default-margin-bottom">
            <h1><?php echo $is_sent ? '<span class="icon-checkmark-circle color-green margin-right-5"></span>' . _s('Message sent') : _s('Contact'); ?></h1>
        </div>
        <form method="post" class="form-content">

            <?php echo G\Render\get_input_auth_token(); ?>

            <p><?php echo $is_sent ? _s('Message sent. We will get in contact soon.') : _s('If you want to send a message fill the form below.'); ?></p>
            <div class="input-label c9">
                <label for="name"><?php _se('Name'); ?></label>
                <input type="text" name="name" id="name" class="text-input" placeholder="<?php _se('Your name'); ?>" value="<?php if ($is_error) {
    echo get_safe_post()['name'];
} ?>" required>
                <div class="input-warning red-warning"><?php echo $input_errors['name']; ?></div>
            </div>
            <div class="input-label c9">
                <label for="email"><?php _se('Email address'); ?></label>
                <input type="email" name="email" id="email" class="text-input" placeholder="<?php _se('Your email address'); ?>" value="<?php if ($is_error) {
    echo get_safe_post()['email'];
} ?>" required>
                <div class="input-warning red-warning"><?php echo $input_errors['name']; ?></div>
            </div>
            <div class="input-label c9">
                <label for="subject"><?php _se('Subject'); ?></label>
                <select type="text" name="subject" id="subject" class="text-input">
                    <?php
                        $ask_for = get_safe_post() ? get_safe_post()['subject'] : '';
                        foreach($allowed_subjects as $k => $v) {
                    ?>
                    <option value="<?php echo $k; ?>"<?php if ($ask_for == $k) {
                                ?> selected<?php
                            } ?>><?php echo $v; ?></option>
                    <?php
                        }
                    ?>
                </select>
                <div class="input-warning red-warning"><?php echo $input_errors['subject']; ?></div>
            </div>
            <div class="input-label c12">
                <label for="message"><?php _se('Message'); ?></label>
                <textarea name="message" id="message" class="text-input r3" required><?php if ($is_error) {
                        echo get_safe_post()['message'];
                    } ?></textarea>
                <div class="input-warning red-warning"><?php echo $input_errors['message']; ?></div>
            </div>
            <?php if (G\Handler::getCond('captcha_show')) {
                        ?>
            <?php if (G\Handler::getVar('recaptcha_html')) {
                            ?>
            <div class="input-label">
                <label for="recaptcha_response_field">reCAPTCHA</label>
                <?php echo G\Handler::getVar('recaptcha_html'); ?>
            </div>
            <?php
                        } ?>
            <div class="input-below red-warning"><?php echo $input_errors['recaptcha']; ?></div>
            <?php
                    } ?>
            <div class="btn-container">
                <button class="btn btn-input default" type="submit"><?php _se('Send'); ?></button> <span class="btn-alt"><?php _se('or'); ?> <a href="<?php echo G\get_base_url(); ?>"><?php _se('cancel'); ?></a></span>
            </div>
        </form>
    </div>
</div>

<?php if ($_POST and $is_error) {
                        ?>
<script>
$(function() {
    PF.fn.growl.call("<?php echo $error ? $error : _s('Check the errors in the form to continue.'); ?>");
});
</script>
<?php
                    } ?>

<?php G\Render\include_theme_footer(); ?>
 

DeCysos

Phoenix Foto Service
Beta tester
The problem has been solved.
The reCaptcha now works as usual.

Apparently it was not the script but the service of Google itself.

The topic can be closed, thanks.
 
Top