Skip to content

Commit

Permalink
Решение конфликта 2-х капчей на странице
Browse files Browse the repository at this point in the history
  • Loading branch information
chiliec committed Sep 22, 2014
1 parent 935de19 commit dd2bc92
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions PluginRecaptcha.class.php
Expand Up @@ -30,6 +30,7 @@ public function Deactivate(){
}

public function Init() {
$this->Viewer_AppendScript(Plugin::GetTemplatePath(__CLASS__)."js/script.js");
Config::Set('module.user.captcha_use_registration', false);
}
}
Expand Down
6 changes: 2 additions & 4 deletions classes/hooks/HookRecaptcha.class.php
Expand Up @@ -18,14 +18,12 @@ public function RegisterHook() {
}

public function Recaptcha() {
$recaptcha = recaptcha_get_html(Config::Get('plugin.recaptcha.public_key'), null, Config::Get('plugin.recaptcha.use_ssl'));
$this->Viewer_Assign('recaptcha', $recaptcha);
return $this->Viewer_Fetch(Plugin::GetTemplatePath(__CLASS__).'inject.recaptcha.tpl');
}

public function Recaptcha_modal() {
$recaptcha = recaptcha_get_html(Config::Get('plugin.recaptcha.public_key'), null, Config::Get('plugin.recaptcha.use_ssl'));
$this->Viewer_Assign('recaptcha_modal', $recaptcha);
$recaptcha = recaptcha_get_html(Config::Get('plugin.recaptcha.public_key'), null, Config::Get('plugin.recaptcha.use_ssl'));
$this->Viewer_Assign('recaptcha', $recaptcha);
return $this->Viewer_Fetch(Plugin::GetTemplatePath(__CLASS__).'inject.recaptcha_modal.tpl');
}
}
Expand Down
2 changes: 1 addition & 1 deletion templates/skin/default/inject.recaptcha.tpl
@@ -1,7 +1,7 @@
<dl class="form-item">
<dt><label for="registration-user-captcha">{$aLang.registration_captcha}:</label></dt>
<dd>
{$recaptcha}
<div id="registration-user-captcha"></div>
<small class="validate-error-hide validate-error-field-captcha"></small>
</dd>
</dl>
2 changes: 1 addition & 1 deletion templates/skin/default/inject.recaptcha_modal.tpl
@@ -1,4 +1,4 @@
<p><label for="popup-registration-captcha">{$aLang.registration_captcha}</label>
{$recaptcha_modal}
<div id="popup-registration-captcha">{$recaptcha}</div>
<small class="validate-error-hide validate-error-field-captcha"></small>
</p>
6 changes: 6 additions & 0 deletions templates/skin/default/js/script.js
@@ -0,0 +1,6 @@
jQuery(document).ready(function() {
setTimeout(
function() {
$('#registration-user-captcha').html($('#popup-registration-captcha').clone(true,true));
},2000);
});

0 comments on commit dd2bc92

Please sign in to comment.