New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recaptcha V2 just spins #539
Comments
This should be conflict with mootools: Compatability bind, that could have worked earlier (https://gist.github.com/sleemanj/f076ed2c0b887ab08074b55dad2fd636 #374 (comment)) also stop working. |
Thanks for your answer! how can i solve this????? I don't found the solution :-( |
What version of Mootools do you use? 1.6.0 resolves some Array.from related issues. |
I can confirm problem on mootools 1.4.2 |
the problem happens with both 1.4.2 and 1.6. I have managed to solve the problem by not loading mootools in the urls where the captcha loads. It is the only radical way by which I have been able to do it. |
1.6.0 without comp. layer is working for me |
The problematic code in compatibility mode is: and in 1.5.1 and earlier version Array.from implementation which doesn't handle objects like MapIterate and Set. |
For me it's worked in template index.php after <jdoc:include type="head"/> : |
it removes core of mootools which can be used somewhere in your site. for example in my case it is used in virtuemart users/orders pages. removing it may lead to other issues. |
for me it resolves problem with recaptcha but brings problems in admin part of site (e.g. on pages with availability to sort entities: articles, orders, etc). enabling compat layer even with fix form #374 brokes recaptcha. |
I agree with you. This leads to other problems on the site. Spoilers and sliders break |
Unfortunately, this is the only option currently used. _scripts[$this->baseurl.'/media/system/js/mootools-core.js']);} ?> |
Using @sleemanj's original bind compatibility approach and the // Add this BEFORE mootools is loaded
Function.prototype._nativeBind = Function.prototype.bind;
Array._nativeFrom = Array.from; // Add this AFTER mootools is loaded
var isRecaptcha = function() {
var stack = new Error().stack;
if (!stack) {
try {
throw new Error();
} catch (e) {
stack = e.stack;
}
}
return stack.match(/recaptcha/);
}
Function.prototype._mootoolsBind = Function.prototype.bind;
Array._mootoolsFrom = Array.from;
Function.prototype.bind = function (...args) {
return isRecaptcha() ? this._nativeBind(...args) : this._mootoolsBind(...args);
};
Array.from = function (...args) {
return isRecaptcha() ? this._nativeFrom(...args) : this._mootoolsFrom(...args);
}; I've not tested this thoroughly yet and there could be issues with it! Improvements welcome. |
Okay, I have a much elegant solution for this....
with this
Patched files are below if anyone needs.... Unzip into JPATH_ROOT/media/system/js/ |
post the file if it works please |
Edited and uploaded in thread above ;) |
Cool, it seems to work... Could you write what the error was and what caused it? Thanks man!!! |
thx all ;_) |
pinta83-WO (dev) |
Note that you may need to clear the browser cache for this to work. |
This works without having to run a script before mootools is loaded: // Add this AFTER mootools is loaded
(function fixMooToolsAndRecaptchaMapsIssueIffy() {
// restore native Array.from by getting the native implemenation from a new frame
var frame = document.createElement('iframe');
frame.sandbox = 'allow-same-origin';
document.body.appendChild(frame);
Array._nativeFrom = frame.contentWindow.Array.from
Function.prototype._nativeBind= frame.contentWindow.Function.prototype.bind
frame.remove();
var isRecaptchaOrMaps = function() {
var stack = new Error().stack;
if (!stack) {
try {
throw new Error();
} catch (e) {
stack = e.stack;
}
}
return stack.match(/recaptcha/) || stack.match(/maps\.google\.com/);
}
Function.prototype._mootoolsBind = Function.prototype.bind;
Array._mootoolsFrom = Array.from;
Function.prototype.bind = function (...args) {
return isRecaptchaOrMaps () ? this._nativeBind(...args) : this._mootoolsBind(...args);
};
Array.from = function (...args) {
return isRecaptchaOrMaps () ? this._nativeFrom(...args) : this._mootoolsFrom(...args);
};
})(); |
Issue description
I have a problem with recaptcha v2. It has stopped working without having changed anything. When checking, it only rotates and does not verify.
Environment
google/recaptcha
version: V2Reproducing the issue
The text was updated successfully, but these errors were encountered: