mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 11:11:39 +09:00
issue 1351 capcha addon enhancement (without filterFuction)
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10236 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
70c43df807
commit
9d27269134
8 changed files with 146 additions and 77 deletions
|
|
@ -43,7 +43,15 @@
|
|||
if(Context::getRequestMethod()!='XMLRPC' && Context::getRequestMethod()!=='JSON')
|
||||
{
|
||||
if($type == 'inline') {
|
||||
$this->compareCaptcha();
|
||||
if(!$this->compareCaptcha())
|
||||
{
|
||||
Context::loadLang('./addons/captcha/lang');
|
||||
$_SESSION['XE_VALIDATOR_ERROR'] = -1;
|
||||
$_SESSION['XE_VALIDATOR_MESSAGE'] = Context::getLang('captcha_denied');;
|
||||
$_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = 'error';
|
||||
$_SESSION['XE_VALIDATOR_RETURN_URL'] = Context::get('error_return_url');
|
||||
$ModuleHandler->_setInputValueToSession();
|
||||
}
|
||||
} else {
|
||||
Context::addHtmlHeader('<script type="text/javascript"> var captchaTargetAct = new Array("'.implode('","',$target_acts).'"); </script>');
|
||||
Context::loadFile(array('./addons/captcha/captcha.js', 'body', '', null), true);
|
||||
|
|
@ -255,7 +263,10 @@
|
|||
|
||||
function before_module_init_captchaCompare()
|
||||
{
|
||||
if(!$this->compareCaptcha()) return false;
|
||||
if(!$this->compareCaptcha())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
header("Content-Type: text/xml; charset=UTF-8");
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
|
|
@ -314,13 +325,19 @@ EOD;
|
|||
|
||||
if(method_exists($oAddonCaptcha, $called_position))
|
||||
{
|
||||
if(!call_user_func_array(array(&$oAddonCaptcha, $called_position), array(&$this))) return false;
|
||||
if(!call_user_func_array(array(&$oAddonCaptcha, $called_position), array(&$this)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$addon_act = Context::get('captcha_action');
|
||||
if($addon_act && method_exists($oAddonCaptcha, $called_position.'_'.$addon_act))
|
||||
{
|
||||
if(!call_user_func_array(array(&$oAddonCaptcha, $called_position.'_'.$addon_act), array(&$this))) return false;
|
||||
if(!call_user_func_array(array(&$oAddonCaptcha, $called_position.'_'.$addon_act), array(&$this)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,55 @@ var calledArgs = null;
|
|||
var captchaXE = null;
|
||||
|
||||
function xeCaptcha() {
|
||||
$('form').each(function(i)
|
||||
{
|
||||
var isSubmitHook = false;
|
||||
if (!$(this).attr('onsubmit') || $(this).attr('onsubmit').indexOf('procFilter') < 0)
|
||||
{
|
||||
var act = $(this).find('input[name=act]').val()
|
||||
for(var i = 0; i<captchaTargetAct.length; i++)
|
||||
{
|
||||
if(captchaTargetAct[i] == act)
|
||||
{
|
||||
isSubmitHook = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (isSubmitHook)
|
||||
{
|
||||
$(this).append('<input type="hidden" name="captchaType" value="inline" />');
|
||||
if(!$(this).find('input[name=error_return_url]'))
|
||||
$(this).append('<input type="hidden" name="error_return_url" value="'+current_url+'" />');
|
||||
$(this).submit(function(event){
|
||||
if ($(this).find('input[name=secret_text]').val())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
var self = this;
|
||||
|
||||
$('#captcha_layer form')
|
||||
.submit(function(e){
|
||||
e.preventDefault();
|
||||
if(!$('#secret_text').val()){
|
||||
$(this).find('input[type=text]').val('').focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
$(self).append('<input type="hidden" name="secret_text" value="'+ $('#secret_text').val() +'" />');
|
||||
$(self).submit();
|
||||
});
|
||||
var params = new Array();
|
||||
params['captcha_action'] = 'setCaptchaSession';
|
||||
params['mid'] = current_mid;
|
||||
oldExecXml('', '', params, captchaXE.show,new Array('error','message','about_captcha','captcha_reload','captcha_play','cmd_input','cmd_cancel'));
|
||||
});
|
||||
}
|
||||
});
|
||||
var body = $(document.body);
|
||||
var captchaIma;
|
||||
|
||||
|
|
@ -47,15 +96,6 @@ var calledArgs = null;
|
|||
'</form>'+_object_ +
|
||||
'</div>').appendTo(captchaXE);
|
||||
|
||||
$div.find('form')
|
||||
.submit(function(){
|
||||
if(!$('#secret_text').val()){
|
||||
$div.find('input[type=text]').val('').focus();
|
||||
return false;
|
||||
}
|
||||
captchaXE.compare(); return false;
|
||||
});
|
||||
|
||||
$div.find('button.cancel')
|
||||
.click(function(){ $('#captcha_layer').hide(); });
|
||||
|
||||
|
|
@ -83,6 +123,16 @@ var calledArgs = null;
|
|||
$.each(captchaTargetAct || {}, function(key,val){ if (val == act){ doCheck = true; return false; } });
|
||||
|
||||
if (doCheck) { /* captcha 를 사용하는 경우 */
|
||||
|
||||
$('#captcha_layer form')
|
||||
.submit(function(e){
|
||||
e.preventDefault();
|
||||
if(!$('#secret_text').val()){
|
||||
$(this).find('input[type=text]').val('').focus();
|
||||
return false;
|
||||
}
|
||||
captchaXE.compare(); return false;
|
||||
});
|
||||
calledArgs = {'module':module,'act':act,'params':params,'callback_func':callback_func,'response_tags':response_tags,'callback_func_arg':callback_func_arg,'fo_obj':fo_obj};
|
||||
var params = new Array();
|
||||
params['captcha_action'] = 'setCaptchaSession';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue