회원가입이나 글쓰기시 AJAX로 통신하다보면 검증값때문에 더이상 진행이 안될때 구글챕챠를 리셋하고 다시 인증해야하는 상황이 있습니다.
/plugin/recaptcha|recaptcha.user.lib.php
// 캡챠 HTML 코드 출력
function captcha_html($class="captcha")
{
global $config;
/*
#hl=ko 표시는 언어지정가능
*/
$html = '<fieldset id="captcha" class="captcha recaptcha">';
//$html .= '<script src="https://www.google.com/recaptcha/api.js?hl=ko"></script>';
$html .= '<script src="https://www.google.com/recaptcha/api.js?onload=onload_grecaptchaCallback&render=explicit"></script>';
$html .= '<script src="'.G5_CAPTCHA_URL.'/recaptcha.js"></script>';
$html .= '<div class="g-recaptcha" id="g-recaptcha" data-sitekey="'.$config['cf_recaptcha_site_key'].'"></div>';
$html .= '</fieldset>';
return $html;
}
/plugin/recaptcha|recaptcha.js 하단에 추가
var grecaptchaId;
var onload_grecaptchaCallback = function() {
grecaptchaId = grecaptcha.render('g-recaptcha', {
'sitekey' : document.querySelector('#g-recaptcha').getAttribute("data-sitekey"),
'theme' : 'light' //dark
});
};
초기화 시킬때는 자바스크립트로
grecaptcha.reset(grecaptchaId);
이렇게 해주시면 됩니다.
게시글 목록
| 번호 | 제목 |
|---|---|
| 24318 | |
| 24317 | |
| 24315 | |
| 24309 | |
| 24294 | |
| 24293 | |
| 24277 | |
| 24262 | |
| 24260 | |
| 24253 | |
| 24251 | |
| 24236 | |
| 24233 | |
| 24228 | |
| 24226 | |
| 24221 | |
| 24214 | |
| 24203 | |
| 24201 | |
| 24199 | |
| 24196 | |
| 24195 | |
| 24194 | |
| 24192 | |
| 24191 | |
| 24187 | |
| 24185 | |
| 24183 | |
| 24172 | |
| 24168 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기