first commit
This commit is contained in:
21
administrator/modules/mod_login/mod_login.php
Normal file
21
administrator/modules/mod_login/mod_login.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_login
|
||||
*
|
||||
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Helper\AuthenticationHelper;
|
||||
use Joomla\CMS\Helper\ModuleHelper;
|
||||
use Joomla\Module\Login\Administrator\Helper\LoginHelper;
|
||||
|
||||
$langs = LoginHelper::getLanguageList();
|
||||
$extraButtons = AuthenticationHelper::getLoginButtons('form-login');
|
||||
$return = LoginHelper::getReturnUri();
|
||||
|
||||
require ModuleHelper::getLayoutPath('mod_login', $params->get('layout', 'default'));
|
||||
44
administrator/modules/mod_login/mod_login.xml
Normal file
44
administrator/modules/mod_login/mod_login.xml
Normal file
@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="administrator" method="upgrade">
|
||||
<name>mod_login</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2005-03</creationDate>
|
||||
<copyright>(C) 2005 Open Source Matters, Inc.</copyright>
|
||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||
<authorEmail>admin@joomla.org</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>3.0.0</version>
|
||||
<description>MOD_LOGIN_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Module\Login</namespace>
|
||||
<files>
|
||||
<filename module="mod_login">mod_login.php</filename>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_login.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_login.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Admin_Modules:_Login_Form" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="advanced">
|
||||
<field
|
||||
name="layout"
|
||||
type="modulelayout"
|
||||
label="JFIELD_ALT_LAYOUT_LABEL"
|
||||
class="form-select"
|
||||
validate="moduleLayout"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="moduleclass_sfx"
|
||||
type="textarea"
|
||||
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
|
||||
rows="3"
|
||||
validate="CssIdentifier"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
78
administrator/modules/mod_login/src/Helper/LoginHelper.php
Normal file
78
administrator/modules/mod_login/src/Helper/LoginHelper.php
Normal file
@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_login
|
||||
*
|
||||
* @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Module\Login\Administrator\Helper;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\LanguageHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Helper for mod_login
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
abstract class LoginHelper
|
||||
{
|
||||
/**
|
||||
* Get an HTML select list of the available languages.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getLanguageList()
|
||||
{
|
||||
$languages = LanguageHelper::createLanguageList(null, JPATH_ADMINISTRATOR, false, true);
|
||||
|
||||
if (\count($languages) <= 1) {
|
||||
return '';
|
||||
}
|
||||
|
||||
usort(
|
||||
$languages,
|
||||
function ($a, $b) {
|
||||
return strcmp($a['value'], $b['value']);
|
||||
}
|
||||
);
|
||||
|
||||
// Fix wrongly set parentheses in RTL languages
|
||||
if (Factory::getApplication()->getLanguage()->isRtl()) {
|
||||
foreach ($languages as &$language) {
|
||||
$language['text'] .= '‎';
|
||||
}
|
||||
}
|
||||
|
||||
array_unshift($languages, HTMLHelper::_('select.option', '', Text::_('JDEFAULTLANGUAGE')));
|
||||
|
||||
return HTMLHelper::_('select.genericlist', $languages, 'lang', 'class="form-select"', 'value', 'text', null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the redirect URI after login.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getReturnUri()
|
||||
{
|
||||
$uri = Uri::getInstance();
|
||||
$return = 'index.php' . $uri->toString(['query']);
|
||||
|
||||
if ($return !== 'index.php?option=com_login') {
|
||||
return base64_encode($return);
|
||||
}
|
||||
|
||||
return base64_encode('index.php');
|
||||
}
|
||||
}
|
||||
127
administrator/modules/mod_login/tmpl/default.php
Normal file
127
administrator/modules/mod_login/tmpl/default.php
Normal file
@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_login
|
||||
*
|
||||
* @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Router\Route;
|
||||
|
||||
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||
$wa = $app->getDocument()->getWebAssetManager();
|
||||
$wa->useScript('keepalive')
|
||||
->useScript('field.passwordview')
|
||||
->registerAndUseScript('mod_login.admin', 'mod_login/admin-login.min.js', [], ['defer' => true], ['core', 'form.validate']);
|
||||
|
||||
Text::script('JSHOWPASSWORD');
|
||||
Text::script('JHIDEPASSWORD');
|
||||
?>
|
||||
<form class="form-validate" action="<?php echo Route::_('index.php', true); ?>" method="post" id="form-login">
|
||||
<fieldset>
|
||||
<legend class="visually-hidden"><?php echo Text::_('MOD_LOGIN'); ?></legend>
|
||||
<div class="form-group">
|
||||
<label for="mod-login-username">
|
||||
<?php echo Text::_('JGLOBAL_USERNAME'); ?>
|
||||
</label>
|
||||
<div class="input-group">
|
||||
|
||||
<input
|
||||
name="username"
|
||||
id="mod-login-username"
|
||||
type="text"
|
||||
class="form-control"
|
||||
required="required"
|
||||
autofocus
|
||||
autocomplete="username"
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="mod-login-password">
|
||||
<?php echo Text::_('JGLOBAL_PASSWORD'); ?>
|
||||
</label>
|
||||
<div class="input-group">
|
||||
|
||||
<input
|
||||
name="passwd"
|
||||
id="mod-login-password"
|
||||
type="password"
|
||||
class="form-control input-full"
|
||||
required="required"
|
||||
autocomplete="current-password"
|
||||
>
|
||||
<button type="button" class="btn btn-primary input-password-toggle">
|
||||
<span class="icon-eye icon-fw" aria-hidden="true"></span>
|
||||
<span class="visually-hidden"><?php echo Text::_('JSHOWPASSWORD'); ?></span>
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-4">
|
||||
<?php if (!empty($langs)) : ?>
|
||||
<div class="form-group">
|
||||
<label for="lang">
|
||||
<?php echo Text::_('MOD_LOGIN_LANGUAGE'); ?>
|
||||
</label>
|
||||
<?php echo $langs; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php foreach ($extraButtons as $button) :
|
||||
$dataAttributeKeys = array_filter(array_keys($button), function ($key) {
|
||||
return substr($key, 0, 5) == 'data-';
|
||||
});
|
||||
?>
|
||||
<div class="form-group">
|
||||
<button type="button"
|
||||
class="btn btn-secondary w-100 <?php echo $button['class'] ?? '' ?>"
|
||||
<?php foreach ($dataAttributeKeys as $key) : ?>
|
||||
<?php echo $key ?>="<?php echo $button[$key] ?>"
|
||||
<?php endforeach; ?>
|
||||
<?php if ($button['onclick']) : ?>
|
||||
onclick="<?php echo $button['onclick'] ?>"
|
||||
<?php endif; ?>
|
||||
title="<?php echo Text::_($button['label']) ?>"
|
||||
id="<?php echo $button['id'] ?>"
|
||||
>
|
||||
<?php if (!empty($button['icon'])) : ?>
|
||||
<span class="<?php echo $button['icon'] ?>"></span>
|
||||
<?php elseif (!empty($button['image'])) : ?>
|
||||
<?php echo $button['image']; ?>
|
||||
<?php elseif (!empty($button['svg'])) : ?>
|
||||
<?php echo $button['svg']; ?>
|
||||
<?php endif; ?>
|
||||
<?php echo Text::_($button['label']) ?>
|
||||
</button>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<div class="form-group">
|
||||
<button type="submit" id="btn-login-submit" class="btn btn-primary w-100 btn-lg"><?php echo Text::_('JLOGIN'); ?></button>
|
||||
</div>
|
||||
<input type="hidden" name="option" value="com_login">
|
||||
<input type="hidden" name="task" value="login">
|
||||
<input type="hidden" name="return" value="<?php echo $return; ?>">
|
||||
<?php echo HTMLHelper::_('form.token'); ?>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
<div class="text-center">
|
||||
<div>
|
||||
<?php echo HTMLHelper::link(
|
||||
Text::_('MOD_LOGIN_CREDENTIALS_LINK'),
|
||||
Text::_('MOD_LOGIN_CREDENTIALS'),
|
||||
[
|
||||
'target' => '_blank',
|
||||
'rel' => 'noopener nofollow',
|
||||
'title' => Text::sprintf('JBROWSERTARGET_NEW_TITLE', Text::_('MOD_LOGIN_CREDENTIALS'))
|
||||
]
|
||||
); ?>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user