Vinoteca: модуль, шаблон и компоненты интернет-магазина вина на 1С-Битрикс
This commit is contained in:
commit
bb7d8af290
469 files changed
+26426
No files matched your search
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
$MESS["VINO_RESET_KICKER"] = "My account";
|
||||
$MESS["VINO_RESET_TITLE"] = "New password";
|
||||
$MESS["VINO_RESET_LEAD"] = "Create a new password to sign in.";
|
||||
$MESS["VINO_RESET_PASSWORD"] = "New password";
|
||||
$MESS["VINO_RESET_HINT"] = "At least 8 characters";
|
||||
$MESS["VINO_RESET_SHOW"] = "Show";
|
||||
$MESS["VINO_RESET_HIDE"] = "Hide";
|
||||
$MESS["VINO_RESET_SUBMIT"] = "Save password";
|
||||
$MESS["VINO_RESET_DONE"] = "Password changed. You can sign in now.";
|
||||
$MESS["VINO_RESET_LOGIN"] = "Sign in";
|
||||
$MESS["VINO_RESET_AGAIN"] = "Request a new link";
|
||||
$MESS["VINO_RESET_ERR_PASSWORD"] = "Password must be at least 8 characters";
|
||||
$MESS["VINO_RESET_ERR_LINK"] = "The link is invalid or expired";
|
||||
$MESS["VINO_RESET_ERR_ALTCHA"] = "Verification failed. Please try again.";
|
||||
$MESS["VINO_RESET_ERR_TOO_OFTEN"] = "Too many attempts, try again later";
|
||||
$MESS["VINO_RESET_ERR_RETRY"] = "Please submit again";
|
||||
$MESS["VINO_RESET_ERR_COMMON"] = "Failed. Please try again later";
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
$MESS["VINO_RESET_KICKER"] = "Moje konto";
|
||||
$MESS["VINO_RESET_TITLE"] = "Nowe hasło";
|
||||
$MESS["VINO_RESET_LEAD"] = "Utwórz nowe hasło do logowania.";
|
||||
$MESS["VINO_RESET_PASSWORD"] = "Nowe hasło";
|
||||
$MESS["VINO_RESET_HINT"] = "Co najmniej 8 znaków";
|
||||
$MESS["VINO_RESET_SHOW"] = "Pokaż";
|
||||
$MESS["VINO_RESET_HIDE"] = "Ukryj";
|
||||
$MESS["VINO_RESET_SUBMIT"] = "Zapisz hasło";
|
||||
$MESS["VINO_RESET_DONE"] = "Hasło zostało zmienione. Możesz się teraz zalogować.";
|
||||
$MESS["VINO_RESET_LOGIN"] = "Zaloguj się";
|
||||
$MESS["VINO_RESET_AGAIN"] = "Poproś o nowy link";
|
||||
$MESS["VINO_RESET_ERR_PASSWORD"] = "Hasło musi mieć co najmniej 8 znaków";
|
||||
$MESS["VINO_RESET_ERR_LINK"] = "Link jest nieprawidłowy lub wygasł";
|
||||
$MESS["VINO_RESET_ERR_ALTCHA"] = "Weryfikacja nieudana. Spróbuj ponownie.";
|
||||
$MESS["VINO_RESET_ERR_TOO_OFTEN"] = "Zbyt wiele prób, spróbuj ponownie później";
|
||||
$MESS["VINO_RESET_ERR_RETRY"] = "Wyślij ponownie";
|
||||
$MESS["VINO_RESET_ERR_COMMON"] = "Błąd. Spróbuj ponownie później";
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
$MESS["VINO_RESET_KICKER"] = "Личный кабинет";
|
||||
$MESS["VINO_RESET_TITLE"] = "Новый пароль";
|
||||
$MESS["VINO_RESET_LEAD"] = "Придумайте новый пароль для входа.";
|
||||
$MESS["VINO_RESET_PASSWORD"] = "Новый пароль";
|
||||
$MESS["VINO_RESET_HINT"] = "Не короче 8 символов";
|
||||
$MESS["VINO_RESET_SHOW"] = "Показать";
|
||||
$MESS["VINO_RESET_HIDE"] = "Скрыть";
|
||||
$MESS["VINO_RESET_SUBMIT"] = "Сохранить пароль";
|
||||
$MESS["VINO_RESET_DONE"] = "Пароль изменён. Теперь можно войти.";
|
||||
$MESS["VINO_RESET_LOGIN"] = "Войти";
|
||||
$MESS["VINO_RESET_AGAIN"] = "Запросить новую ссылку";
|
||||
$MESS["VINO_RESET_ERR_PASSWORD"] = "Пароль не короче 8 символов";
|
||||
$MESS["VINO_RESET_ERR_LINK"] = "Ссылка недействительна или устарела";
|
||||
$MESS["VINO_RESET_ERR_ALTCHA"] = "Проверка не пройдена. Повторите попытку.";
|
||||
$MESS["VINO_RESET_ERR_TOO_OFTEN"] = "Слишком много попыток, повторите позже";
|
||||
$MESS["VINO_RESET_ERR_RETRY"] = "Повторите отправку";
|
||||
$MESS["VINO_RESET_ERR_COMMON"] = "Не удалось. Повторите позже";
|
||||
@@ -0,0 +1,90 @@
|
||||
(function () {
|
||||
function init() {
|
||||
var form = document.querySelector('[data-auth-reset]');
|
||||
if (!form) return;
|
||||
if (!window.BX || !BX.ajax || !BX.ajax.runAction) {
|
||||
form.addEventListener('submit', function (event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
return;
|
||||
}
|
||||
var password = form.elements.password;
|
||||
var submit = form.querySelector('[type="submit"]');
|
||||
var err = form.querySelector('[data-auth-err]');
|
||||
var done = document.querySelector('[data-auth-done]');
|
||||
var guard = form.querySelector('altcha-widget');
|
||||
var started = Date.now();
|
||||
var codes = { too_often: 'tooOften', altcha: 'altcha', retry: 'retry', link: 'link', password: 'password' };
|
||||
|
||||
function message(code) {
|
||||
var key = codes[code] || 'error';
|
||||
return form.dataset['msg' + key.charAt(0).toUpperCase() + key.slice(1)] || form.dataset.msgError;
|
||||
}
|
||||
|
||||
function mark(field, bad) {
|
||||
field.classList.toggle('vino-inp--invalid', bad);
|
||||
field.setAttribute('aria-invalid', bad ? 'true' : 'false');
|
||||
}
|
||||
|
||||
VinoAltcha.arm(guard);
|
||||
|
||||
form.addEventListener('input', function (event) {
|
||||
if (event.target.classList.contains('vino-inp--invalid')) mark(event.target, false);
|
||||
});
|
||||
|
||||
form.addEventListener('submit', function (event) {
|
||||
event.preventDefault();
|
||||
var bad = password.value.length < 8;
|
||||
mark(password, bad);
|
||||
if (bad) {
|
||||
err.textContent = form.dataset.msgPassword;
|
||||
password.focus();
|
||||
return;
|
||||
}
|
||||
err.textContent = '';
|
||||
submit.disabled = true;
|
||||
VinoAltcha.armed(guard).then(function (ok) {
|
||||
if (!ok) return Promise.reject({ errors: [{ code: 'altcha' }] });
|
||||
return BX.ajax.runAction('jinove:vinoteca.password.reset', {
|
||||
data: {
|
||||
login: form.dataset.login,
|
||||
checkword: form.dataset.checkword,
|
||||
password: password.value,
|
||||
website: form.elements.website.value,
|
||||
elapsed: String(Date.now() - started),
|
||||
altcha: form.elements.altcha ? form.elements.altcha.value : ''
|
||||
}
|
||||
});
|
||||
}).then(function () {
|
||||
form.hidden = true;
|
||||
done.hidden = false;
|
||||
done.focus();
|
||||
}, function (response) {
|
||||
var code = response && response.errors && response.errors[0] ? response.errors[0].code : '';
|
||||
VinoAltcha.reset(guard);
|
||||
if (code === 'link') {
|
||||
form.hidden = true;
|
||||
var note = document.createElement('p');
|
||||
note.className = 'vino-auth__err vino-auth__err--static';
|
||||
note.setAttribute('role', 'alert');
|
||||
note.textContent = form.dataset.msgLink;
|
||||
var again = document.createElement('a');
|
||||
again.className = 'vino-auth__link';
|
||||
again.href = form.dataset.again;
|
||||
again.textContent = form.dataset.msgAgain;
|
||||
form.parentNode.appendChild(note);
|
||||
form.parentNode.appendChild(again);
|
||||
return;
|
||||
}
|
||||
submit.disabled = false;
|
||||
err.textContent = message(code);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', init);
|
||||
} else {
|
||||
init();
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
use Bitrix\Main\Localization\Loc;
|
||||
|
||||
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
|
||||
die();
|
||||
}
|
||||
|
||||
Loc::loadMessages(__FILE__);
|
||||
$this->addExternalCss("/local/components/jinove/auth.login/templates/.default/style.css");
|
||||
$uid = "vino-reset";
|
||||
$valid = $arResult["LOGIN"] !== "" && $arResult["CHECKWORD"] !== "";
|
||||
?>
|
||||
<section class="vino-auth vino-auth--single">
|
||||
<div class="vino-auth__card">
|
||||
<p class="vino-auth__kicker"><?= Loc::getMessage("VINO_RESET_KICKER") ?></p>
|
||||
<h1 class="vino-auth__title"><?= Loc::getMessage("VINO_RESET_TITLE") ?></h1>
|
||||
<p class="vino-auth__done" role="status" tabindex="-1" hidden data-auth-done>
|
||||
<?= Loc::getMessage("VINO_RESET_DONE") ?>
|
||||
<a class="vino-auth__link" href="<?= htmlspecialcharsbx($arResult["LOGIN_URL"]) ?>"><?= Loc::getMessage("VINO_RESET_LOGIN") ?></a>
|
||||
</p>
|
||||
<?php if (!$valid): ?>
|
||||
<p class="vino-auth__err vino-auth__err--static" role="alert"><?= Loc::getMessage("VINO_RESET_ERR_LINK") ?></p>
|
||||
<div class="vino-auth__links">
|
||||
<a class="vino-auth__link" href="<?= htmlspecialcharsbx($arResult["FORGOT_URL"]) ?>"><?= Loc::getMessage("VINO_RESET_AGAIN") ?></a>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<p class="vino-auth__lead"><?= Loc::getMessage("VINO_RESET_LEAD") ?></p>
|
||||
<form class="vino-auth__form" method="post" novalidate data-auth-reset
|
||||
data-login="<?= htmlspecialcharsbx($arResult["LOGIN"]) ?>"
|
||||
data-checkword="<?= htmlspecialcharsbx($arResult["CHECKWORD"]) ?>"
|
||||
data-again="<?= htmlspecialcharsbx($arResult["FORGOT_URL"]) ?>"
|
||||
data-msg-password="<?= htmlspecialcharsbx(Loc::getMessage("VINO_RESET_ERR_PASSWORD")) ?>"
|
||||
data-msg-again="<?= htmlspecialcharsbx(Loc::getMessage("VINO_RESET_AGAIN")) ?>"
|
||||
data-msg-link="<?= htmlspecialcharsbx(Loc::getMessage("VINO_RESET_ERR_LINK")) ?>"
|
||||
data-msg-altcha="<?= htmlspecialcharsbx(Loc::getMessage("VINO_RESET_ERR_ALTCHA")) ?>"
|
||||
data-msg-too-often="<?= htmlspecialcharsbx(Loc::getMessage("VINO_RESET_ERR_TOO_OFTEN")) ?>"
|
||||
data-msg-retry="<?= htmlspecialcharsbx(Loc::getMessage("VINO_RESET_ERR_RETRY")) ?>"
|
||||
data-msg-error="<?= htmlspecialcharsbx(Loc::getMessage("VINO_RESET_ERR_COMMON")) ?>"
|
||||
data-label-show="<?= htmlspecialcharsbx(Loc::getMessage("VINO_RESET_SHOW")) ?>"
|
||||
data-label-hide="<?= htmlspecialcharsbx(Loc::getMessage("VINO_RESET_HIDE")) ?>">
|
||||
<input type="text" name="website" class="vino-hp" tabindex="-1" autocomplete="off" aria-hidden="true">
|
||||
<div class="vino-auth__field">
|
||||
<label class="vino-auth__label" for="<?= $uid ?>-password"><?= Loc::getMessage("VINO_RESET_PASSWORD") ?></label>
|
||||
<span class="vino-auth__password">
|
||||
<input class="vino-inp vino-auth__input" id="<?= $uid ?>-password" type="password" name="password" autocomplete="new-password" minlength="8" maxlength="200" aria-describedby="<?= $uid ?>-hint <?= $uid ?>-err" required>
|
||||
<button type="button" class="vino-auth__toggle" data-password-toggle hidden aria-controls="<?= $uid ?>-password"><?= Loc::getMessage("VINO_RESET_SHOW") ?></button>
|
||||
</span>
|
||||
<span class="vino-auth__hint" id="<?= $uid ?>-hint"><?= Loc::getMessage("VINO_RESET_HINT") ?></span>
|
||||
</div>
|
||||
<altcha-widget name="altcha" challenge="/bitrix/services/main/ajax.php?action=jinove:vinoteca.lead.challenge" auto="onload" display="invisible"></altcha-widget>
|
||||
<p class="vino-auth__err" id="<?= $uid ?>-err" role="alert" data-auth-err></p>
|
||||
<button class="vino-btn vino-auth__submit" type="submit"><?= Loc::getMessage("VINO_RESET_SUBMIT") ?></button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</section>
|
||||
Reference in new issue
Block a user