<?php
if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) {
    die();
}

use \Bitrix\Main\Localization\Loc;

Loc::loadMessages(__FILE__);
?>


<div class="user_forms" id="auth_form">
    <? if ($arResult['ERRORS']): ?>
        <div class="user_forms_alert">
            <? foreach ($arResult['ERRORS'] as $error) {
                echo $error;
            }
            ?>
        </div>
    <? endif; ?>

    <form name="<?= $arResult['FORM_ID']; ?>" method="post" target="_top" action="<?= POST_FORM_ACTION_URI; ?>">

        <div class="user_forms_item">
            <input type="text" name="<?= $arResult['FIELDS']['login']; ?>" maxlength="255" placeholder="E-mail"
                   value="" autocomplete="off"/>
        </div>
        <div class="user_forms_item">
            <input type="password" name="<?= $arResult['FIELDS']['password']; ?>" placeholder="Пароль" maxlength="255"
                   autocomplete="off"/>
        </div>

        <? if ($arResult['STORE_PASSWORD'] == 'Y'): ?>
            <div class="user_forms_store">
                <label>
                    <input type="checkbox" id="USER_REMEMBER" name="<?= $arResult['FIELDS']['remember']; ?>" value="Y"/>
                    <span class="bx-filter-param-text">
                    Запомнить пароль
                    </span>
                </label>

                <a href="<?= $arParams['AUTH_FORGOT_PASSWORD_URL'] ?>" rel="nofollow">
                    Забыли пароль?
                </a>

            </div>
        <? endif ?>

        <div class="user_forms_submit">
            <input type="submit" class="btn btn_colored" name="<?= $arResult['FIELDS']['action']; ?>"
                   value="<?= Loc::getMessage('MAIN_AUTH_FORM_FIELD_SUBMIT'); ?>"/>
        </div>
        <div class="user_forms_reg">
            <h5>Нет аккаунта?</h5>
            <a class="btn btn_not_colored" href="/personal/auth/registration.php" rel="nofollow">
                <span>Зарегистрироваться</span>
            </a>
        </div>
    </form>
</div>

<script type="text/javascript">
    <?if ($arResult['LAST_LOGIN'] != ''):?>
    try {
        document.<?= $arResult['FORM_ID'];?>.USER_PASSWORD.focus();
    } catch (e) {
    }
    <?else:?>
    try {
        document.<?= $arResult['FORM_ID'];?>.USER_LOGIN.focus();
    } catch (e) {
    }
    <?endif?>
</script>