Files
ave-cms/system/App/Frontend/Auth/view/phone.twig
T

44 lines
3.5 KiB
Twig

{% if phone_providers %}
{% set phone_provider = phone_providers|first %}
<div class="system-public-auth-phone" data-phone-auth data-provider="{{ phone_provider.code }}">
{% if password_login_enabled|default(false) %}
<div class="system-public-auth-oauth-divider"><span>{{ phone_auth_registration|default(false) ? 'или зарегистрируйтесь по телефону' : 'или войдите по телефону' }}</span></div>
{% else %}
<div class="system-public-auth-phone-heading"><span aria-hidden="true">+7</span><div><h2>{{ phone_auth_registration|default(false) ? 'Регистрация по телефону' : 'Вход по телефону' }}</h2><p>Отправим одноразовый код. Пароль запоминать не нужно.</p></div></div>
{% endif %}
<form action="{{ base }}/auth/phone/request" method="post" data-phone-auth-request>
<input type="hidden" name="_csrf" value="{{ csrf|e }}">
<input type="hidden" name="provider" value="{{ phone_provider.code|e }}">
<input type="hidden" name="_return" value="{{ return_url|default('/')|e }}">
<label class="system-public-auth-phone-label" for="phone-auth-number">Номер телефона</label>
<div class="system-public-auth-phone-row">
<input class="form-control" id="phone-auth-number" type="tel" name="phone" autocomplete="tel" inputmode="tel" placeholder="+7 (000) 000-00-00" maxlength="18" pattern="\+7 \([0-9]{3}\) [0-9]{3}-[0-9]{2}-[0-9]{2}" data-phone-mask required>
<button class="btn btn-secondary" type="submit">Получить код</button>
</div>
{% if phone_provider.allow_registration and phone_registration_enabled %}
<label class="system-public-auth-phone-consent">
<input type="checkbox" name="consent" value="1">
<span><b>Нет аккаунта?</b> Создать его после подтверждения номера и принять <a href="{{ base }}{{ config.checkout_policy_url|default('/privacy-policy') }}">политику конфиденциальности</a>.</span>
</label>
{% endif %}
<div class="system-public-auth-phone-message" data-phone-auth-message hidden role="status"></div>
</form>
<form action="{{ base }}/auth/phone/verify" method="post" data-phone-auth-verify hidden>
<input type="hidden" name="_csrf" value="{{ csrf|e }}">
<input type="hidden" name="provider" value="{{ phone_provider.code|e }}">
<input type="hidden" name="challenge" value="">
<label class="system-public-auth-phone-label" for="phone-auth-code">Код из SMS</label>
<div class="system-public-auth-phone-row">
<input class="form-control" id="phone-auth-code" name="code" inputmode="numeric" autocomplete="one-time-code" pattern="[0-9]{4,8}" maxlength="8" placeholder="Код из SMS" required>
<button class="btn btn-primary" type="submit">{{ phone_auth_registration|default(false) ? 'Зарегистрироваться' : 'Войти' }}</button>
</div>
<label class="system-public-auth-phone-remember"><input type="checkbox" name="keep_in" value="1"><span>Запомнить меня</span></label>
<div class="system-public-auth-phone-message" data-phone-auth-message role="status"></div>
<div class="system-public-auth-phone-links">
<button class="system-public-auth-phone-back" type="button" data-phone-auth-back>Изменить номер</button>
<button class="system-public-auth-phone-resend" type="button" data-phone-auth-resend disabled>Отправить код ещё раз</button>
</div>
</form>
</div>
{% endif %}