<?php
/**
 * @package     MefisAssetBridge
 * @subpackage  Joomla_Administrator_Component
 *
 * @copyright   Copyright (C) 2025 Goran Usljebrka. All rights reserved.
 * @license     Proprietary — No resale or incorporation into other projects without explicit written permission. see LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;
?>

<h3><?php echo Text::_('COM_MEFISASSETBRIDGE_AUTH_LOGIN_TITLE'); ?></h3>
<p class="lead-"><?php echo Text::_('COM_MEFISASSETBRIDGE_AUTH_LOGIN_DESC'); ?></p>

<form action="<?php echo Route::_('index.php?option=com_mefisassetbridge&task=auth.authenticate'); ?>" method="post" name="loginForm" id="login-form" class="form-validate">

    <div class="mb-3">
        <label for="email" class="form-label"><?php echo Text::_('COM_MEFISASSETBRIDGE_AUTH_EMAIL_LABEL'); ?></label>
        <input type="email" name="email" id="email" class="form-control required" required
               value="<?php echo $this->escape($this->app->input->get('email', '', 'raw')); ?>">
    </div>

    <div class="mb-5">
        <label for="password" class="form-label"><?php echo Text::_('COM_MEFISASSETBRIDGE_AUTH_PASSWORD_LABEL'); ?></label>
        <input type="password" name="password" id="password" class="form-control required"  required minlength="8">
    </div>

    <div class="card mb-5 border shadow alert alert-info">
        <div class="card-body">
            <h3><?php echo Text::_('COM_MEFISASSETBRIDGE_AUTH_MASTER_KEY_LABEL'); ?></h3>
            <p><?php echo Text::_('COM_MEFISASSETBRIDGE_AUTH_MASTER_KEY_LEAD_TEXT'); ?></p>
            <input type="text" placeholder="<?php echo Text::_('COM_MEFISASSETBRIDGE_AUTH_MASTER_KEY_LEAD_PLACEHOLDER'); ?>" autocomplete="off" name="master_key" id="master_key" class="form-control required" required minlength="4">
        </div>
    </div>

    <div class="mb-3">
        <button type="submit" class="btn btn-primary">
            <?php echo Text::_('COM_MEFISASSETBRIDGE_AUTH_LOGIN_BUTTON'); ?>
        </button>
    </div>

    <input type="hidden" name="returnurl" value="<?php echo urldecode($this->app->input->get('returnurl', '', 'raw')); ?>">
    <?php echo HTMLHelper::_('form.token'); ?>
</form>