2301* @param {string} code - код ошибки2302* @param {number} [activationLeftCount] - кол-во оставшихся попыток2303*/2304function tma__sign__showErrorOneCode(form, code, activationLeftCount) {2305var loginType = tma__sign__getLoginType();23062307// Одинаковые коды ошибок с бэка для разных типов входа нужно отображать по-разному2308var loginTextErrors = ['invalid', 'blocked', 'login_blocked', 'empty_data'];2309var dictGroup = loginTextErrors.includes(code) ? `one_code_${loginType}` : 'one_code';23102311if (activationLeftCount && activationLeftCount <= 3) {
var arrayError = ['activation_1', 'activation_2', 'activation_3']; var text = tma__getDeclinationlNumber(activationLeftCount, arrayError); tma__showErrorRequest(form, text, 'sign_dict', `one_code_${loginType}`, { activationcount: activationLeftCount, }); } else { tma__showErrorRequest(form, code, 'sign_dict', dictGroup); }}function tma__sign__sendLogoutWihtRedirect() { var objProfile = tma__getProfileObjFromLS(); var logoutData = JSON.stringify({ projectid: objProfile.projectid, token: objProfile.token, tzoffset: new Date().getTimezoneOffset(), }); tma__request('/api/logout/', logoutData, '', function () { var profileName = 'tilda_members_profile' + objProfile.projectid; try { window.mauser = {}; localStorage.removeItem(profileName); localStorage.removeItem(profileName + '_timestamp'); } catch (error) { console.info(error); } document.location.replace('/members/login'); });}/** * Разлогируем авторизованного пользователя для регистрации по одноразовому паролю, * сейчас нельзя регистрироваться авторизованным, в будущем будет такая возможность * TODO: после реализации регистрации удалить функцию и все упоминания об кнопке выхода */function tma__sign__sendLogout() { var objProfile = tma__getProfileObjFromLS(); var logoutData = JSON.stringify({ projectid: objProfile.projectid, token: objProfile.token, tzoffset: new Date().getTimezoneOffset(), }); tma__request('/api/logout/', logoutData, '', function () { var profileName = `tilda_members_profile${objProfile.projectid}`; try { window.mauser = {}; localStorage.removeItem(profileName); localStorage.removeItem(`${profileName}_timestamp`); } catch (error) { console.info(error); } var inputEmail = document.querySelector('[name="login"], [name="phone"]'); var logoutBtn = document.querySelector('.tlk-form__logout'); var logoutItem = logoutBtn.closest('.tlk-form__item'); inputEmail.disabled = false; inputEmail.value = ''; logoutItem.remove(); logoutBtn.removeEventListener('click', tma__sign__sendLogout); });}/** * Возвращает HTML кнопки показать/скрыть пароль * * @returns {string} */function tma__sign__getPasswordToggleHtml() { const closedEyePath = 'M2.30357 2.65814C2.629 2.3327 3.15664 2.3327 3.48208 2.65814L6.01566 5.19172C7.31696 4.48323 8.80903 4.08073 10.3932 4.08073C14.499 4.08073 17.9722 6.77945 19.1401 10.4977C19.1911 10.6603 19.1911 10.8346 19.1401 10.9971C18.5961 12.7289 17.5532 14.2378 16.1805 15.3565L18.4821 17.6581C18.8075 17.9836 18.8075 18.5112 18.4821 18.8367C18.1566 19.1621 17.629 19.1621 17.3036 18.8367L2.30357 3.83665C1.97813 3.51121 1.97813 2.98358 2.30357 2.65814ZM7.25652 6.43258L8.69964 7.8757C9.19584 7.58264 9.775 7.41406 10.3928 7.41406C12.2338 7.41406 13.7262 8.90645 13.7262 10.7474C13.7262 11.3652 13.5576 11.9444 13.2645 12.4406L14.9945 14.1706C16.117 13.2972 16.9842 12.1123 17.4667 10.7474C16.4369 7.8336 13.6576 5.7474 10.3932 5.7474C9.2724 5.7474 8.21034 5.99276 7.25652 6.43258ZM12.0032 11.1792C12.0399 11.0416 12.0595 10.8969 12.0595 10.7474C12.0595 9.82692 11.3133 9.08073 10.3928 9.08073C10.2434 9.08073 10.0986 9.10029 9.96099 9.13705L12.0032 11.1792ZM4.24689 7.55888C4.61389 7.83661 4.68625 8.35926 4.40852 8.72625C3.94802 9.33476 3.57851 10.0152 3.31972 10.7474C4.34948 13.6612 7.12875 15.7474 10.3932 15.7474C10.8747 15.7474 11.3449 15.7021 11.8 15.6158C12.2521 15.5301 12.6882 15.8271 12.774 16.2793C12.8597 16.7315 12.5627 17.1676 12.1105 17.2533C11.5536 17.3589 10.9794 17.4141 10.3932 17.4141C6.28743 17.4141 2.81415 14.7154 1.64632 10.9971C1.59527 10.8345 1.59527 10.6602 1.64633 10.4977C1.96459 9.48437 2.45374 8.54741 3.07952 7.72051C3.35724 7.35351 3.8799 7.28115 4.24689 7.55888Z'; const openEyePath = 'M3.31972 10.7526C4.34948 13.6664 7.12874 15.7526 10.3932 15.7526C13.6576 15.7526 16.4369 13.6664 17.4667 10.7526C16.4369 7.83882 13.6576 5.7526 10.3932 5.7526C7.12874 5.7526 4.34949 7.83879 3.31972 10.7526ZM1.64633 10.5029C2.81417 6.78462 6.28744 4.08594 10.3932 4.08594C14.499 4.08594 17.9722 6.78466 19.1401 10.5029C19.1911 10.6655 19.1911 10.8398 19.1401 11.0023C17.9722 14.7206 14.499 17.4193 10.3932 17.4193C6.28743 17.4193 2.81415 14.7206 1.64632 11.0023C1.59527 10.8397 1.59527 10.6654 1.64633 10.5029ZM10.3928 9.08594C9.47235 9.08594 8.72616 9.83213 8.72616 10.7526C8.72616 11.6731 9.47235 12.4193 10.3928 12.4193C11.3133 12.4193 12.0595 11.6731 12.0595 10.7526C12.0595 9.83213 11.3133 9.08594 10.3928 9.08594ZM7.05949 10.7526C7.05949 8.91165 8.55187 7.41927 10.3928 7.41927C12.2338 7.41927 13.7262 8.91165 13.7262 10.7526C13.7262 12.5936 12.2338 14.0859 10.3928 14.0859C8.55187 14.0859 7.05949 12.5936 7.05949 10.7526Z'; return ` <div class="tlk-password-toggle"> <span class="tlk-password-icon tlk-password-icon-hidden"> <svg class="tlk-password-icon__closed" xmlns="http://www.w3.org/2000/svg" width="21" height="21" viewBox="0 0 21 21" fill="none"> <path fill-rule="evenodd" clip-rule="evenodd" fill="currentColor" d="${closedEyePath}"></path> </svg> <svg class="tlk-password-icon__open" xmlns="http://www.w3.org/2000/svg" width="21" height="21" viewBox="0 0 21 21" fill="none"> <path fill-rule="evenodd" clip-rule="evenodd" fill="currentColor" d="${openEyePath}"></path> </svg>