mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-26 03:30:48 +03:00
Доработка каптчи
This commit is contained in:
parent
48b1474628
commit
834a449e7a
|
@ -565,6 +565,7 @@ $config['head']['default']['js'] = array(
|
|||
"___path.static.framework___/js/livestreet/topic.js",
|
||||
"___path.static.framework___/js/livestreet/admin.js",
|
||||
"___path.static.framework___/js/livestreet/admin.userfield.js",
|
||||
"___path.static.framework___/js/livestreet/captcha.js",
|
||||
"___path.static.framework___/js/livestreet/init.js",
|
||||
|
||||
"http://yandex.st/share/share.js" => array('merge'=>false),
|
||||
|
|
53
templates/framework/js/livestreet/captcha.js
Normal file
53
templates/framework/js/livestreet/captcha.js
Normal file
|
@ -0,0 +1,53 @@
|
|||
/**
|
||||
* Каптча
|
||||
*/
|
||||
|
||||
var ls = ls || {};
|
||||
|
||||
ls.captcha = (function ($) {
|
||||
var oCaptcha = null;
|
||||
|
||||
/**
|
||||
* Дефолтные опции
|
||||
*/
|
||||
var defaults = {
|
||||
// Селектор каптчи
|
||||
sCaptchaSelector: '.js-form-auth-captcha'
|
||||
};
|
||||
|
||||
/**
|
||||
* Инициализация
|
||||
*/
|
||||
this.init = function(options) {
|
||||
this.options = $.extend({}, defaults, options);
|
||||
|
||||
oCaptcha = $(this.options.sCaptchaSelector);
|
||||
|
||||
// Подгружаем каптчу при открытии окна регистрации
|
||||
$('[data-option-target=tab-pane-registration]').tab('option', 'onActivate', function () {
|
||||
this.updateCaptcha();
|
||||
}.bind(this));
|
||||
|
||||
// Обновляем каптчу при клике на нее
|
||||
oCaptcha.on('click', function () {
|
||||
this.updateCaptcha();
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
/**
|
||||
* Получает url каптчи
|
||||
* @return {String} URL каптчи
|
||||
*/
|
||||
this.getCaptchaUrl = function () {
|
||||
return DIR_ENGINE_LIBS + '/external/kcaptcha/index.php?' + SESSION_NAME + '=' + SESSION_ID + '&n=' + Math.random();
|
||||
};
|
||||
|
||||
/**
|
||||
* Обновляет каптчу
|
||||
*/
|
||||
this.updateCaptcha = function () {
|
||||
oCaptcha.css('background-image', 'url(' + this.getCaptchaUrl() + ')');
|
||||
};
|
||||
|
||||
return this;
|
||||
}).call(ls.captcha || {}, jQuery);
|
|
@ -32,10 +32,6 @@ ls.user = (function ($) {
|
|||
return false;
|
||||
});
|
||||
|
||||
$('[data-option-target=tab-pane-registration]').tab('option', 'onActivate', function () {
|
||||
$('.js-form-auth-captcha').css({ 'background-image': 'url(' + ls.user.captcha_url + ')' });
|
||||
});
|
||||
|
||||
$('.js-form-signup').find('.js-ajax-validate').blur(function(e) {
|
||||
var aParams = {},
|
||||
$this = $(e.target),
|
||||
|
|
|
@ -120,6 +120,12 @@ jQuery(document).ready(function($){
|
|||
ls.user.init();
|
||||
|
||||
|
||||
/**
|
||||
* Captcha
|
||||
*/
|
||||
ls.captcha.init();
|
||||
|
||||
|
||||
/**
|
||||
* Talk
|
||||
*/
|
||||
|
|
|
@ -36,17 +36,15 @@
|
|||
<i class="icon-validation-success validate-ok-field-password_confirm" style="display: none"></i>
|
||||
<small class="validate-error-hide validate-error-field-password_confirm"></small></p>
|
||||
|
||||
{* Каптча *}
|
||||
{hookb run="registration_captcha"}
|
||||
<script>
|
||||
ls.user.captcha_url = '{cfg name='path.root.engine_lib'}/external/kcaptcha/index.php?{$_sPhpSessionName}={$_sPhpSessionId}&n=' + Math.random();
|
||||
</script>
|
||||
|
||||
{**
|
||||
* Каптча
|
||||
*
|
||||
* @scripts <framework>/js/livestreet/captcha.js
|
||||
*}
|
||||
{hookb run="registration_captcha" isPopup=$isModal}
|
||||
<p><label for="js-form-signup-captcha">{$aLang.registration_captcha}</label>
|
||||
<span {if ! $isModal}style="background-image: url({cfg name='path.root.engine_lib'}/external/kcaptcha/index.php?{$_sPhpSessionName}={$_sPhpSessionId});"{/if}
|
||||
onclick="this.style.backgroundImage='url({cfg name='path.root.engine_lib'}/external/kcaptcha/index.php?{$_sPhpSessionName}={$_sPhpSessionId}&n='+Math.random() + ')'"
|
||||
class="form-auth-captcha js-form-auth-captcha"></span>
|
||||
<input type="text" name="captcha" value="" maxlength="3" id="js-form-signup-login" class="width-100 js-ajax-validate js-form-signup-captcha" />
|
||||
<span {if ! $isModal}style="background-image: url({cfg name='path.root.engine_lib'}/external/kcaptcha/index.php?{$_sPhpSessionName}={$_sPhpSessionId});"{/if} class="form-auth-captcha js-form-auth-captcha"></span>
|
||||
<input type="text" name="captcha" value="" maxlength="3" id="js-form-signup-captcha" class="width-100 js-ajax-validate js-form-signup-captcha" />
|
||||
<small class="validate-error-hide validate-error-field-captcha"></small></p>
|
||||
{/hookb}
|
||||
|
||||
|
|
|
@ -44,8 +44,10 @@
|
|||
var DIR_WEB_ROOT = '{cfg name="path.root.web"}',
|
||||
DIR_STATIC_SKIN = '{cfg name="path.static.skin"}',
|
||||
DIR_STATIC_FRAMEWORK = '{cfg name="path.static.framework"}',
|
||||
DIR_ENGINE_LIBS = '{cfg name="path.root.engine_lib"}',
|
||||
LIVESTREET_SECURITY_KEY = '{$LIVESTREET_SECURITY_KEY}',
|
||||
SESSION_ID = '{$_sPhpSessionId}',
|
||||
SESSION_NAME = '{$_sPhpSessionName}',
|
||||
LANGUAGE = '{$oConfig->GetValue('lang.current')}',
|
||||
WYSIWYG = {if $oConfig->GetValue('view.wysiwyg')}true{else}false{/if};
|
||||
|
||||
|
|
|
@ -167,6 +167,13 @@ jQuery(document).ready(function($){
|
|||
*/
|
||||
ls.user.init();
|
||||
|
||||
|
||||
/**
|
||||
* Captcha
|
||||
*/
|
||||
ls.captcha.init();
|
||||
|
||||
|
||||
// вступление в блог
|
||||
ls.hook.add('ls_blog_toggle_join_after',function(idBlog,result){
|
||||
if (!this.data('onlyText')) {
|
||||
|
|
|
@ -36,17 +36,15 @@
|
|||
<i class="icon-validation-success validate-ok-field-password_confirm" style="display: none"></i>
|
||||
<small class="validate-error-hide validate-error-field-password_confirm"></small></p>
|
||||
|
||||
{* Каптча *}
|
||||
{hookb run="registration_captcha"}
|
||||
<script>
|
||||
ls.user.captcha_url = '{cfg name='path.root.engine_lib'}/external/kcaptcha/index.php?{$_sPhpSessionName}={$_sPhpSessionId}&n=' + Math.random();
|
||||
</script>
|
||||
|
||||
{**
|
||||
* Каптча
|
||||
*
|
||||
* @scripts <framework>/js/livestreet/captcha.js
|
||||
*}
|
||||
{hookb run="registration_captcha" isPopup=$isModal}
|
||||
<p class="form-signup-field-captcha"><label for="js-form-signup-captcha">{$aLang.registration_captcha}</label>
|
||||
<span {if ! $isModal}style="background-image: url({cfg name='path.root.engine_lib'}/external/kcaptcha/index.php?{$_sPhpSessionName}={$_sPhpSessionId});"{/if}
|
||||
onclick="this.style.backgroundImage='url({cfg name='path.root.engine_lib'}/external/kcaptcha/index.php?{$_sPhpSessionName}={$_sPhpSessionId}&n='+Math.random() + ')'"
|
||||
class="form-auth-captcha js-form-auth-captcha"></span>
|
||||
<input type="text" name="captcha" value="" maxlength="3" id="js-form-signup-login" class="width-100 js-ajax-validate js-form-signup-captcha" />
|
||||
<span {if ! $isModal}style="background-image: url({cfg name='path.root.engine_lib'}/external/kcaptcha/index.php?{$_sPhpSessionName}={$_sPhpSessionId});"{/if} class="form-auth-captcha js-form-auth-captcha"></span>
|
||||
<input type="text" name="captcha" value="" maxlength="3" id="js-form-signup-captcha" class="width-100 js-ajax-validate js-form-signup-captcha" />
|
||||
<small class="validate-error-hide validate-error-field-captcha"></small></p>
|
||||
{/hookb}
|
||||
|
||||
|
|
|
@ -46,8 +46,10 @@
|
|||
var DIR_WEB_ROOT = '{cfg name="path.root.web"}',
|
||||
DIR_STATIC_SKIN = '{cfg name="path.static.skin"}',
|
||||
DIR_STATIC_FRAMEWORK = '{cfg name="path.static.framework"}',
|
||||
DIR_ENGINE_LIBS = '{cfg name="path.root.engine_lib"}',
|
||||
LIVESTREET_SECURITY_KEY = '{$LIVESTREET_SECURITY_KEY}',
|
||||
SESSION_ID = '{$_sPhpSessionId}',
|
||||
SESSION_NAME = '{$_sPhpSessionName}',
|
||||
LANGUAGE = '{$oConfig->GetValue('lang.current')}',
|
||||
WYSIWYG = {if $oConfig->GetValue('view.wysiwyg')}true{else}false{/if};
|
||||
|
||||
|
|
Loading…
Reference in a new issue