<?php
/**
 * Maho
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2006-2020 Magento, Inc. (https://magento.com)
 * @copyright   Copyright (c) 2021-2023 The OpenMage Contributors (https://openmage.org)
 * @copyright   Copyright (c) 2024 Maho (https://mahocommerce.com)
 * @license     https://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */

/** @var Mage_Customer_Block_Form_Login $this */
?>
<?php $isRegistrationAllowed = $this->helper('customer')->isRegistrationAllowed() ?>
<div class="account-login<?php if (!$isRegistrationAllowed) echo ' login-only' ?>">
    <div class="page-title">
    <?php if ($isRegistrationAllowed): ?>
        <h1><?= $this->__('Login or Create an Account') ?></h1>
    <?php else: ?>
        <h1><?= $this->__('Login') ?></h1>
    <?php endif ?>
    </div>
    <?= $this->getMessagesBlock()->toHtml() ?>
    <?php /* Extensions placeholder */ ?>
    <?= $this->getChildHtml('customer.form.login.extra') ?>
    <form action="<?= $this->getPostActionUrl() ?>" method="post" id="login-form">
        <?= $this->getBlockHtml('formkey') ?>
        <div class="col2-set">
            <?php if ($isRegistrationAllowed): ?>
            <div class="col-1 new-users">
                <div class="content">
                    <h2><?= $this->__('New Customers') ?></h2>
                    <p><?= $this->__('By creating an account with our store, you will be able to move through the checkout process faster, store multiple shipping addresses, view and track your orders in your account and more.') ?></p>
                </div>
                <div class="buttons-set">
                    <a title="<?= $this->quoteEscape($this->__('Create an Account')) ?>" class="button" href="<?= $this->getCreateAccountUrlContext() ?>"><?= $this->__('Create an Account') ?></a>
                </div>
            </div>
            <?php endif ?>
            <?php // This column should be col-1 if the registration column is not displayed ?>
            <div class="<?= $isRegistrationAllowed ? 'col-2' : 'col-1'?> registered-users">
                <div class="content fieldset">
                    <h2><?= $this->__('Registered Customers') ?></h2>
                    <p class="form-instructions"><?= $this->__('If you have an account with us, please log in.') ?></p>
                    <p class="required"><?= $this->__('* Required Fields') ?></p>
                    <ul class="form-list">
                        <li>
                            <label for="email" class="required"><em>*</em><?= $this->__('Email Address') ?></label>
                            <div class="input-box">
                                <input type="email" autocapitalize="off" autocorrect="off" spellcheck="false" name="login[username]" value="<?= $this->escapeHtml($this->getUsername()) ?>" id="email" class="input-text required-entry validate-email" title="<?= $this->quoteEscape($this->__('Email Address')) ?>" />
                            </div>
                        </li>
                        <li>
                            <?php $minPasswordLength = $this->getMinPasswordLength(); ?>
                            <label for="pass" class="required"><em>*</em><?= $this->__('Password') ?></label>
                            <div class="input-box">
                                <input type="password" name="login[password]" class="input-text required-entry validate-password min-pass-length-<?= $minPasswordLength ?>" id="pass" title="<?= $this->quoteEscape($this->__('Password')) ?>" autocomplete="off" />
                            </div>
                        </li>
                        <?= $this->getChildHtml('form.additional.info') ?>
                        <li>
                            <a href="<?= $this->getForgotPasswordUrl() ?>" class="f-left"><?= $this->__('Forgot Your Password?') ?></a>
                        </li>
                        <?= $this->getChildHtml('remember.me') ?>
                    </ul>
                </div>
                <div class="buttons-set">
                    <button type="submit" class="button" title="<?= $this->quoteEscape($this->__('Login')) ?>" name="send" id="send2"><?= $this->__('Login') ?></button>
                </div>
            </div>
        </div>
        <?php if (Mage::helper('checkout')->isContextCheckout()): ?>
            <input name="context" type="hidden" value="checkout" />
        <?php endif ?>
    </form>
    <script type="text/javascript">
        var dataForm = new VarienForm('login-form', true);
    </script>
</div>
