Vinoteca: модуль, шаблон и компоненты интернет-магазина вина на 1С-Битрикс
This commit is contained in:
commit
bb7d8af290
469 files changed
+26426
No files matched your search
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
$MESS["VINO_FORGOT_KICKER"] = "My account";
|
||||
$MESS["VINO_FORGOT_TITLE"] = "Password recovery";
|
||||
$MESS["VINO_FORGOT_LEAD"] = "Enter the e-mail used at registration.";
|
||||
$MESS["VINO_FORGOT_EMAIL"] = "E-mail";
|
||||
$MESS["VINO_FORGOT_SUBMIT"] = "Get the link";
|
||||
$MESS["VINO_FORGOT_BACK"] = "Back to sign in";
|
||||
$MESS["VINO_FORGOT_ERR_EMAIL"] = "Enter a valid e-mail";
|
||||
$MESS["VINO_FORGOT_ERR_CONSENT"] = "Consent to data processing is required";
|
||||
$MESS["VINO_FORGOT_DEMO"] = "There are no users on this demonstration site";
|
||||
$MESS["VINO_FORGOT_CONSENT"] = 'By clicking “#BUTTON#”, I agree to the processing of my <a class="vino-consent__link" href="#URL#" target="_blank">personal data</a> on the terms and for the purposes set out in the <a class="vino-consent__link" href="#PRIVACY_URL#" target="_blank">Privacy Policy</a>.';
|
||||
$MESS["VINO_FORGOT_DONE"] = "If an account with this e-mail exists, a password reset link has been sent to it.";
|
||||
$MESS["VINO_FORGOT_ERR_ALTCHA"] = "Verification failed. Please try again.";
|
||||
$MESS["VINO_FORGOT_ERR_TOO_OFTEN"] = "Too many attempts, try again later";
|
||||
$MESS["VINO_FORGOT_ERR_RETRY"] = "Please submit again";
|
||||
$MESS["VINO_FORGOT_ERR_COMMON"] = "Failed. Please try again later";
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
$MESS["VINO_FORGOT_KICKER"] = "Moje konto";
|
||||
$MESS["VINO_FORGOT_TITLE"] = "Odzyskiwanie hasła";
|
||||
$MESS["VINO_FORGOT_LEAD"] = "Wpisz adres e-mail podany przy rejestracji.";
|
||||
$MESS["VINO_FORGOT_EMAIL"] = "E-mail";
|
||||
$MESS["VINO_FORGOT_SUBMIT"] = "Wyślij link";
|
||||
$MESS["VINO_FORGOT_BACK"] = "Wróć do logowania";
|
||||
$MESS["VINO_FORGOT_ERR_EMAIL"] = "Wpisz poprawny adres e-mail";
|
||||
$MESS["VINO_FORGOT_ERR_CONSENT"] = "Wymagana zgoda na przetwarzanie danych";
|
||||
$MESS["VINO_FORGOT_DEMO"] = "Na stronie demonstracyjnej nie ma użytkowników";
|
||||
$MESS["VINO_FORGOT_CONSENT"] = 'Klikając „#BUTTON#”, wyrażam zgodę na przetwarzanie moich <a class="vino-consent__link" href="#URL#" target="_blank">danych osobowych</a> na warunkach i w celach określonych w <a class="vino-consent__link" href="#PRIVACY_URL#" target="_blank">Polityce prywatności</a>.';
|
||||
$MESS["VINO_FORGOT_DONE"] = "Jeśli konto z tym adresem e-mail istnieje, link do zmiany hasła został wysłany na ten adres.";
|
||||
$MESS["VINO_FORGOT_ERR_ALTCHA"] = "Weryfikacja nieudana. Spróbuj ponownie.";
|
||||
$MESS["VINO_FORGOT_ERR_TOO_OFTEN"] = "Zbyt wiele prób, spróbuj ponownie później";
|
||||
$MESS["VINO_FORGOT_ERR_RETRY"] = "Wyślij ponownie";
|
||||
$MESS["VINO_FORGOT_ERR_COMMON"] = "Błąd. Spróbuj ponownie później";
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
$MESS["VINO_FORGOT_KICKER"] = "Личный кабинет";
|
||||
$MESS["VINO_FORGOT_TITLE"] = "Восстановление пароля";
|
||||
$MESS["VINO_FORGOT_LEAD"] = "Введите e-mail, указанный при регистрации.";
|
||||
$MESS["VINO_FORGOT_EMAIL"] = "E-mail";
|
||||
$MESS["VINO_FORGOT_SUBMIT"] = "Получить ссылку";
|
||||
$MESS["VINO_FORGOT_BACK"] = "Вернуться ко входу";
|
||||
$MESS["VINO_FORGOT_ERR_EMAIL"] = "Введите корректный e-mail";
|
||||
$MESS["VINO_FORGOT_ERR_CONSENT"] = "Нужно согласие на обработку данных";
|
||||
$MESS["VINO_FORGOT_DEMO"] = "На демонстрационном сайте нет пользователей";
|
||||
$MESS["VINO_FORGOT_CONSENT"] = 'Нажимая «#BUTTON#», я соглашаюсь на обработку <a class="vino-consent__link" href="#URL#" target="_blank">персональных данных</a> на условиях и для целей, определённых <a class="vino-consent__link" href="#PRIVACY_URL#" target="_blank">Политикой конфиденциальности</a>.';
|
||||
$MESS["VINO_FORGOT_DONE"] = "Если аккаунт с таким e-mail есть, на него отправлена ссылка для смены пароля.";
|
||||
$MESS["VINO_FORGOT_ERR_ALTCHA"] = "Проверка не пройдена. Повторите попытку.";
|
||||
$MESS["VINO_FORGOT_ERR_TOO_OFTEN"] = "Слишком много попыток, повторите позже";
|
||||
$MESS["VINO_FORGOT_ERR_RETRY"] = "Повторите отправку";
|
||||
$MESS["VINO_FORGOT_ERR_COMMON"] = "Не удалось. Повторите позже";
|
||||
@@ -0,0 +1,83 @@
|
||||
(function () {
|
||||
function init() {
|
||||
var form = document.querySelector('[data-auth-forgot]');
|
||||
if (!form) return;
|
||||
if (!window.BX || !BX.ajax || !BX.ajax.runAction) {
|
||||
form.addEventListener('submit', function (event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
return;
|
||||
}
|
||||
var email = form.elements.email;
|
||||
var consent = form.elements.consent;
|
||||
var submit = form.querySelector('[type="submit"]');
|
||||
var err = form.querySelector('[data-auth-err]');
|
||||
var done = document.querySelector('[data-auth-done]');
|
||||
var consentBox = form.querySelector('.vino-auth__consent');
|
||||
var guard = form.querySelector('altcha-widget');
|
||||
var started = Date.now();
|
||||
var codes = { too_often: 'tooOften', altcha: 'altcha', retry: 'retry', email: 'email' };
|
||||
|
||||
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);
|
||||
});
|
||||
consent.addEventListener('change', function () {
|
||||
consentBox.classList.remove('vino-consent--invalid');
|
||||
});
|
||||
|
||||
form.addEventListener('submit', function (event) {
|
||||
event.preventDefault();
|
||||
var emailValue = email.value.trim();
|
||||
var badEmail = !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(emailValue);
|
||||
var badConsent = !consent.checked;
|
||||
mark(email, badEmail);
|
||||
consentBox.classList.toggle('vino-consent--invalid', badConsent);
|
||||
consent.setAttribute('aria-invalid', badConsent ? 'true' : 'false');
|
||||
if (badEmail || badConsent) {
|
||||
err.textContent = badEmail ? form.dataset.msgEmail : form.dataset.msgConsent;
|
||||
(badEmail ? email : consent).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.request', {
|
||||
data: {
|
||||
email: emailValue,
|
||||
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) {
|
||||
submit.disabled = false;
|
||||
VinoAltcha.reset(guard);
|
||||
var code = response && response.errors && response.errors[0] ? response.errors[0].code : '';
|
||||
err.textContent = message(code);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', init);
|
||||
} else {
|
||||
init();
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,40 @@
|
||||
<?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-forgot";
|
||||
?>
|
||||
<section class="vino-auth vino-auth--single">
|
||||
<div class="vino-auth__card">
|
||||
<p class="vino-auth__kicker"><?= Loc::getMessage("VINO_FORGOT_KICKER") ?></p>
|
||||
<h1 class="vino-auth__title"><?= Loc::getMessage("VINO_FORGOT_TITLE") ?></h1>
|
||||
<p class="vino-auth__lead"><?= Loc::getMessage("VINO_FORGOT_LEAD") ?></p>
|
||||
<p class="vino-auth__demo" role="note"><?= Loc::getMessage("VINO_FORGOT_DEMO") ?></p>
|
||||
<p class="vino-auth__done" role="status" tabindex="-1" hidden data-auth-done><?= Loc::getMessage("VINO_FORGOT_DONE") ?></p>
|
||||
<form class="vino-auth__form" method="post" novalidate data-auth-forgot
|
||||
data-msg-email="<?= htmlspecialcharsbx(Loc::getMessage("VINO_FORGOT_ERR_EMAIL")) ?>"
|
||||
data-msg-consent="<?= htmlspecialcharsbx(Loc::getMessage("VINO_FORGOT_ERR_CONSENT")) ?>"
|
||||
data-msg-altcha="<?= htmlspecialcharsbx(Loc::getMessage("VINO_FORGOT_ERR_ALTCHA")) ?>"
|
||||
data-msg-too-often="<?= htmlspecialcharsbx(Loc::getMessage("VINO_FORGOT_ERR_TOO_OFTEN")) ?>"
|
||||
data-msg-retry="<?= htmlspecialcharsbx(Loc::getMessage("VINO_FORGOT_ERR_RETRY")) ?>"
|
||||
data-msg-error="<?= htmlspecialcharsbx(Loc::getMessage("VINO_FORGOT_ERR_COMMON")) ?>">
|
||||
<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 ?>-email"><?= Loc::getMessage("VINO_FORGOT_EMAIL") ?></label>
|
||||
<input class="vino-inp vino-auth__input" id="<?= $uid ?>-email" type="email" name="email" autocomplete="email" inputmode="email" maxlength="254" aria-describedby="<?= $uid ?>-err" required>
|
||||
</div>
|
||||
<label class="vino-consent vino-consent--sm vino-auth__consent"><input class="vino-consent__checkbox" type="checkbox" name="consent" value="1" aria-describedby="<?= $uid ?>-err" required><span class="vino-consent__text"><?= Loc::getMessage("VINO_FORGOT_CONSENT", array("#BUTTON#" => Loc::getMessage("VINO_FORGOT_SUBMIT"), "#URL#" => SITE_DIR . "consent/", "#PRIVACY_URL#" => SITE_DIR . "privacy/")) ?></span></label>
|
||||
<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_FORGOT_SUBMIT") ?></button>
|
||||
<div class="vino-auth__links">
|
||||
<a class="vino-auth__link" href="<?= htmlspecialcharsbx($arResult["LOGIN_URL"]) ?>"><?= Loc::getMessage("VINO_FORGOT_BACK") ?></a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
Reference in new issue
Block a user