PageSourceSearch

https://papafrance.fr/modules/recaptchapro/views/js/captcha_login.js

js papafrance.fr collected 2026-10-07 08:43:03 UTC 6,327 bytes, 145 lines download raw bytes

1/**
2 * 2007-2023 PrestaShop
3 *
4 * NOTICE OF LICENSE
5 *
6 * This source file is subject to the Academic Free License (AFL 3.0)
7 * that is bundled with this package in the file LICENSE.txt.
8 * It is also available through the world-wide-web at this URL:
9 * http://opensource.org/licenses/afl-3.0.php
10 * If you did not receive a copy of the license and are unable to
11 * obtain it through the world-wide-web, please send an email
12 * to [email protected] so we can send you a copy immediately.
13 *
14 * DISCLAIMER
15 *
16 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
17 * versions in the future. If you wish to customize PrestaShop for your
18 * needs please refer to http://www.prestashop.com for more information.
19 *
20 *  @author    PrestaShop SA <[email protected]>
21 *  @copyright 2007-2023 PrestaShop SA
22 *  @license   http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
23 *  International Registered Trademark & Property of PrestaShop SA
24 *
25 * Don't forget to prefix your containers with your own identifier
26 * to avoid any conflicts with others containers.
27 */
28
29// Vanilla document ready
30document.addEventListener('DOMContentLoaded', function() {
31    if (site_key) {
32        // Create structure variables
33        var submit_button = findCM([
34            '#authentication #login-form .form-footer .btn-primary',
35            '#authentication #login_form #SubmitLogin'
36        ]);
37        var captcha_form = findCM([
38            '#authentication #login-form > section',
39            '#authentication #login_form .clearfix > div:nth-child(2)',
40            '#authentication #login_form .clearfix .lost_password',
41            '#authentication #login-form > .form_content',
42            '#authentication #login-form .forgot-password',
43            '#authentication #login-form > div',
44        ]);
45        var error_header = findCM([
46            '#authentication .login-form',
47            '#center_column > .page-heading',
48            '#center_column #login_form .title_block',
49            '#center_column > h1',
50            '#center_column #login-form'
51        ]);
52        var captcha_invisible_form = findCM([
53            '#authentication #login-form',
54            '#authentication #login_form'
55        ]);
56
57        // Check if is whitelisted and display relevant content
58        if (!whitelisted) {
59            // Add our captcha depending to reCaptcha version
60            if (re_version == 1) {
61                // reCaptcha Version 2 Checkbox
62                $(captcha_form).append('<div style="margin-top: 20px;" class="g-recaptcha" data-sitekey="' + site_key + '" data-theme="' + re_theme + '" data-size="' + re_size + '"></div>');
63                
64                var clicked_first = true;
65
66                $(submit_button).on('click', function() {
67                    if (clicked_first == true) {
68                        if ($(submit_button).prop('type') == 'submit') {
69                            $(submit_button).prop('type', 'button');
70                        }
71                    }
72
73                    if (clicked_first == true) {
74                        if (grecaptcha.getResponse()) {
75                            $(submit_button).prop('type', 'submit');
76                            clicked_first = false;
77                            $(submit_button).click();
78                        } else {
79                            $('.captcha-alert').remove();
80                            if (p_version == '1.7' || p_version_short == '8') {
81                                $("<div class='alert alert-danger error captcha-alert'><p>" + there_is1 + "</p><ol><li>" + wrong_captcha + "</ol></div>").hide().insertBefore(error_header).fadeIn(600);
82                            } else {
83                                $("<div class='alert alert-danger error captcha-alert'><p>" + there_is1 + "</p><ol><li>" + wrong_captcha + "</ol></div>").hide().insertAfter(error_header).fadeIn(600);
84                            }
85                        }
86                    }
87                });
88            } else if (re_version == 2 || re_version == 3) {
89                // reCaptcha Version 2 Invisible and Version 3
90                regLOG(captcha_invisible_form, error_header);
91
92                $(captcha_invisible_form).submit(function(event) {
93                    if (!grecaptcha.getResponse()) {
94                        event.preventDefault();
95                        grecaptcha.execute();
96                    }
97                });
98
99                if (re_position == 'inline') {
100                    $(captcha_form).append('<div style="' + (p_version == '1.5' ? 'margin-top: 25px;' : 'margin-top: 20px;') + '" id="recaptcha" class="g-recaptcha" data-sitekey="' + site_key + '" data-callback="onreCSubmitLOG" data-size="invisible" data-badge="inl
100ine"></div>');
101                } else {
102                    $(captcha_invisible_form).append('<div id="recaptcha" class="g-recaptcha" data-sitekey="' + site_key + '" data-callback="onreCSubmitLOG" data-size="invisible" data-badge="bottom' + re_position + '"></div>');
103                }
104                
105                $(captcha_invisible_form).append('<input type="hidden" value="" name="SubmitLogin" />');
106            }
107        } else {
108            if (whitelist_m) {
109                $(captcha_form).append('<input type="hidden" name="recaptcha_whitelisted" value="1" />');
110                $(captcha_form).append('<p class="recaptcha_whitelist">' + whitelist_m + '</p>');
111            } else {
112                $(captcha_form).append('<input type="hidden" name="recaptcha_whitelisted" value="1" />');
113            }
114        }
115    }
116});
117
118// Utility functions
119function onreCSubmitLOG(token) {
120    if (token) {
121        $($('#re_login_captcha_invisible_form').attr('data-parameter')).submit();
122    }
123}
124
125function findCM(str) {
126    var temp = false;
127
128    $.each(str, function(key, value) {
129        if ($(value).length) {
130            temp = value;
131            return false;
132        }
133    });
134
135    if (temp) {
136        return temp;
137    } else {
138        return false;
139    }
140}
141
142function regLOG(captcha_invisible_form, error_header) {
143    $('body').append("<div id='re_login_error_header' data-parameter='" + error_header + "'></div>");
144    $('body').append("<div id='re_login_captcha_invisible_form' data-parameter='" + captcha_invisible_form + "'></div>");
145}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.