{"action":"created","issue":{"url":"https://api.github.com/repos/panique/huge/issues/665","labels_url":"https://api.github.com/repos/panique/huge/issues/665/labels{/name}","comments_url":"https://api.github.com/repos/panique/huge/issues/665/comments","events_url":"https://api.github.com/repos/panique/huge/issues/665/events","html_url":"https://github.com/panique/huge/issues/665","id":83114280,"number":665,"title":"[STICKY][Optional feature] ReCaptcha Support","user":{"login":"tankerkiller125","id":3457368,"avatar_url":"https://avatars.githubusercontent.com/u/3457368?v=3","gravatar_id":"","url":"https://api.github.com/users/tankerkiller125","html_url":"https://github.com/tankerkiller125","followers_url":"https://api.github.com/users/tankerkiller125/followers","following_url":"https://api.github.com/users/tankerkiller125/following{/other_user}","gists_url":"https://api.github.com/users/tankerkiller125/gists{/gist_id}","starred_url":"https://api.github.com/users/tankerkiller125/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tankerkiller125/subscriptions","organizations_url":"https://api.github.com/users/tankerkiller125/orgs","repos_url":"https://api.github.com/users/tankerkiller125/repos","events_url":"https://api.github.com/users/tankerkiller125/events{/privacy}","received_events_url":"https://api.github.com/users/tankerkiller125/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-05-31T15:36:52Z","updated_at":"2015-07-23T00:07:23Z","closed_at":null,"body":"I fully understand that we don't want any more features for the project. I am simply creating this to give people a concept of how to add ReCaptcha to their own pages.\r\n\r\nComposer command (official google lib)\r\n`composer require google/recaptcha \"~1.1\"`\r\n\r\nCode to add to any pages you want a captcha (will use built in if recaptcha not enabled)\r\n```php\r\n<?php if (Config::get('RECAPTCHA_ENABLED')) { ?>\r\n<div class=\"g-recaptcha\" data-sitekey=\"<?php echo Config::get('RECAPTCHA_SITEKEY'); ?>\"></div>\r\n<script src=\"https://www.google.com/recaptcha/api.js\"></script>\r\n<?php } else { ?>\r\n<br><img id=\"captcha\" src=\"<?php echo URL; ?>login/showCaptcha\"/>\r\n<br><input type=\"text\" name=\"captcha\" placeholder=\"Please enter above characters\" required/>\r\n\r\n<!-- quick & dirty captcha reloader -->\r\n<a href=\"#\" style=\"display: block; font-size: 11px; margin: 5px 0 15px 0; text-align: center\" onclick=\"document.getElementById('captcha').src = '<?php echo URL; ?>login/showCaptcha?' + Math.random(); return false\">Reload Captcha</a>\r\n<?php } ?>\r\n```\r\n\r\nCaptchaModel Function (add anywhere you'd like)\r\n```php\r\npublic static function checkRecaptcha($gReCaptchaResponse) {\r\n    $recaptcha = new \\ReCaptcha\\ReCaptcha(Config::get('RECAPTCHA_SECRET'));\r\n    $resp = $recaptcha->verify($gReCaptchaResponse, Request::server('REMOTE_ADDR'));\r\n     if($resp->isSuccess()) {\r\n        return true;\r\n    } else {\r\n        return false;\r\n    }\r\n}\r\n```\r\n\r\nPart you put into your function that checks for captcha (again compatible with built in captcha)\r\n```php\r\nif (Config::get('RECAPTCHA_ENABLED')) {\r\n    if (!CaptchaModel::checkRecaptcha($captcha)) {\r\n       Session::add('feedback_negative', Language::getText('captcha-wrong'));\r\n       return false;\r\n    }\r\n} else {\r\n   if (!CaptchaModel::checkCaptcha($captcha)) {\r\n        Session::add('feedback_negative', Language::getText('captcha-wrong'));\r\n        return false;\r\n    }\r\n}\r\n```\r\n\r\nAnd last but not least this will need to be added to the config array\r\n```php\r\n'RECAPTCHA_ENABLED' => true,\r\n'RECAPTCHA_SECRET' => 'xxxxxxxxx',\r\n'RECAPTCHA_SITEKEY' => 'xxxxxxxxxx',\r\n```"},"comment":{"url":"https://api.github.com/repos/panique/huge/issues/comments/123912165","html_url":"https://github.com/panique/huge/issues/665#issuecomment-123912165","issue_url":"https://api.github.com/repos/panique/huge/issues/665","id":123912165,"user":{"login":"tankerkiller125","id":3457368,"avatar_url":"https://avatars.githubusercontent.com/u/3457368?v=3","gravatar_id":"","url":"https://api.github.com/users/tankerkiller125","html_url":"https://github.com/tankerkiller125","followers_url":"https://api.github.com/users/tankerkiller125/followers","following_url":"https://api.github.com/users/tankerkiller125/following{/other_user}","gists_url":"https://api.github.com/users/tankerkiller125/gists{/gist_id}","starred_url":"https://api.github.com/users/tankerkiller125/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tankerkiller125/subscriptions","organizations_url":"https://api.github.com/users/tankerkiller125/orgs","repos_url":"https://api.github.com/users/tankerkiller125/repos","events_url":"https://api.github.com/users/tankerkiller125/events{/privacy}","received_events_url":"https://api.github.com/users/tankerkiller125/received_events","type":"User","site_admin":false},"created_at":"2015-07-23T00:07:23Z","updated_at":"2015-07-23T00:07:23Z","body":"@mcanatalay Not sure if it will help with CPU however it does reduce bandwidth (since verification and images come from google and not your server)"}}