first commit

This commit is contained in:
2025-06-17 11:53:18 +02:00
commit 9f0f7ba12b
8804 changed files with 1369176 additions and 0 deletions

View File

@ -0,0 +1,34 @@
<?php
/**
* @package Joomla.Site
* @subpackage mod_login
*
* @copyright (C) 2005 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\Factory;
use Joomla\CMS\Helper\AuthenticationHelper;
use Joomla\CMS\Helper\ModuleHelper;
use Joomla\Module\Login\Site\Helper\LoginHelper;
$params->def('greeting', 1);
// HTML IDs
$formId = 'login-form-' . $module->id;
$type = LoginHelper::getType();
$return = LoginHelper::getReturnUrl($params, $type);
$registerLink = LoginHelper::getRegistrationUrl($params);
$extraButtons = AuthenticationHelper::getLoginButtons($formId);
$user = Factory::getUser();
$layout = $params->get('layout', 'default');
// Logged users must load the logout sublayout
if (!$user->guest) {
$layout .= '_logout';
}
require ModuleHelper::getLayoutPath('mod_login', $layout);

View File

@ -0,0 +1,154 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="module" client="site" method="upgrade">
<name>mod_login</name>
<author>Joomla! Project</author>
<creationDate>2006-07</creationDate>
<copyright>(C) 2006 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="Site_Modules:_Login" />
<config>
<fields name="params">
<fieldset name="basic" addfieldprefix="Joomla\Component\Menus\Administrator\Field">
<field
name="pretext"
type="textarea"
label="MOD_LOGIN_FIELD_PRE_TEXT_LABEL"
filter="safehtml"
cols="30"
rows="5"
/>
<field
name="posttext"
type="textarea"
label="MOD_LOGIN_FIELD_POST_TEXT_LABEL"
filter="safehtml"
cols="30"
rows="5"
/>
<field
name="login"
type="modal_menu"
label="MOD_LOGIN_FIELD_LOGIN_REDIRECTURL_LABEL"
description="MOD_LOGIN_FIELD_LOGIN_REDIRECTURL_DESC"
disable="separator,alias,heading,url"
select="true"
new="true"
edit="true"
clear="true"
>
<option value="">JOPTION_SELECT_MENU_ITEM</option>
</field>
<field
name="logout"
type="modal_menu"
label="MOD_LOGIN_FIELD_LOGOUT_REDIRECTURL_LABEL"
description="MOD_LOGIN_FIELD_LOGOUT_REDIRECTURL_DESC"
disable="separator,alias,heading,url"
select="true"
new="true"
edit="true"
clear="true"
>
<option value="">JOPTION_SELECT_MENU_ITEM</option>
</field>
<field
name="customRegLinkMenu"
type="modal_menu"
label="MOD_LOGIN_FIELD_REGISTRATION_MENU_LABEL"
disable="separator,alias,heading,url"
select="true"
new="true"
edit="true"
clear="true"
>
<option value="">JOPTION_SELECT_MENU_ITEM</option>
</field>
<field
name="greeting"
type="radio"
layout="joomla.form.field.radio.switcher"
label="MOD_LOGIN_FIELD_GREETING_LABEL"
default="1"
filter="integer"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="name"
type="radio"
layout="joomla.form.field.radio.switcher"
label="MOD_LOGIN_FIELD_NAME_LABEL"
default="0"
filter="integer"
showon="greeting:1"
>
<option value="0">MOD_LOGIN_VALUE_NAME</option>
<option value="1">MOD_LOGIN_VALUE_USERNAME</option>
</field>
<field
name="profilelink"
type="radio"
label="MOD_LOGIN_FIELD_PROFILE_LABEL"
layout="joomla.form.field.radio.switcher"
default="0"
filter="integer"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="usetext"
type="radio"
layout="joomla.form.field.radio.switcher"
label="MOD_LOGIN_FIELD_USETEXT_LABEL"
default="0"
filter="integer"
>
<option value="0">MOD_LOGIN_VALUE_ICONS</option>
<option value="1">MOD_LOGIN_VALUE_TEXT</option>
</field>
</fieldset>
<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>

View File

@ -0,0 +1,95 @@
<?php
/**
* @package Joomla.Site
* @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
*/
namespace Joomla\Module\Login\Site\Helper;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Multilanguage;
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.5
*/
class LoginHelper
{
/**
* Retrieve the URL where the user should be returned after logging in
*
* @param \Joomla\Registry\Registry $params module parameters
* @param string $type return type
*
* @return string
*/
public static function getReturnUrl($params, $type)
{
$item = Factory::getApplication()->getMenu()->getItem($params->get($type));
// Stay on the same page
$url = Uri::getInstance()->toString();
if ($item) {
$lang = '';
if ($item->language !== '*' && Multilanguage::isEnabled()) {
$lang = '&lang=' . $item->language;
}
$url = 'index.php?Itemid=' . $item->id . $lang;
}
return base64_encode($url);
}
/**
* Returns the current users type
*
* @return string
*/
public static function getType()
{
$user = Factory::getUser();
return (!$user->get('guest')) ? 'logout' : 'login';
}
/**
* Retrieve the URL for the registration page
*
* @param \Joomla\Registry\Registry $params module parameters
*
* @return string
*/
public static function getRegistrationUrl($params)
{
$regLink = 'index.php?option=com_users&view=registration';
$regLinkMenuId = $params->get('customRegLinkMenu');
// If there is a custom menu item set for registration => override default
if ($regLinkMenuId) {
$item = Factory::getApplication()->getMenu()->getItem($regLinkMenuId);
if ($item) {
$regLink = 'index.php?Itemid=' . $regLinkMenuId;
if ($item->language !== '*' && Multilanguage::isEnabled()) {
$regLink .= '&lang=' . $item->language;
}
}
}
return $regLink;
}
}

View File

@ -0,0 +1,139 @@
<?php
/**
* @package Joomla.Site
* @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\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Router\Route;
$app->getDocument()->getWebAssetManager()
->useScript('core')
->useScript('keepalive')
->useScript('field.passwordview');
Text::script('JSHOWPASSWORD');
Text::script('JHIDEPASSWORD');
?>
<form id="login-form-<?php echo $module->id; ?>" class="mod-login" action="<?php echo Route::_('index.php', true); ?>" method="post">
<?php if ($params->get('pretext')) : ?>
<div class="mod-login__pretext pretext">
<p><?php echo $params->get('pretext'); ?></p>
</div>
<?php endif; ?>
<div class="mod-login__userdata userdata">
<div class="mod-login__username form-group">
<?php if (!$params->get('usetext', 0)) : ?>
<div class="input-group">
<input id="modlgn-username-<?php echo $module->id; ?>" type="text" name="username" class="form-control" autocomplete="username" placeholder="<?php echo Text::_('MOD_LOGIN_VALUE_USERNAME'); ?>">
<label for="modlgn-username-<?php echo $module->id; ?>" class="visually-hidden"><?php echo Text::_('MOD_LOGIN_VALUE_USERNAME'); ?></label>
<span class="input-group-text" title="<?php echo Text::_('MOD_LOGIN_VALUE_USERNAME'); ?>">
<span class="icon-user icon-fw" aria-hidden="true"></span>
</span>
</div>
<?php else : ?>
<label for="modlgn-username-<?php echo $module->id; ?>"><?php echo Text::_('MOD_LOGIN_VALUE_USERNAME'); ?></label>
<input id="modlgn-username-<?php echo $module->id; ?>" type="text" name="username" class="form-control" autocomplete="username" placeholder="<?php echo Text::_('MOD_LOGIN_VALUE_USERNAME'); ?>">
<?php endif; ?>
</div>
<div class="mod-login__password form-group">
<?php if (!$params->get('usetext', 0)) : ?>
<div class="input-group">
<input id="modlgn-passwd-<?php echo $module->id; ?>" type="password" name="password" autocomplete="current-password" class="form-control" placeholder="<?php echo Text::_('JGLOBAL_PASSWORD'); ?>">
<label for="modlgn-passwd-<?php echo $module->id; ?>" class="visually-hidden"><?php echo Text::_('JGLOBAL_PASSWORD'); ?></label>
<button type="button" class="btn btn-secondary input-password-toggle">
<span class="icon-eye icon-fw" aria-hidden="true"></span>
<span class="visually-hidden"><?php echo Text::_('JSHOWPASSWORD'); ?></span>
</button>
</div>
<?php else : ?>
<label for="modlgn-passwd-<?php echo $module->id; ?>"><?php echo Text::_('JGLOBAL_PASSWORD'); ?></label>
<input id="modlgn-passwd-<?php echo $module->id; ?>" type="password" name="password" autocomplete="current-password" class="form-control" placeholder="<?php echo Text::_('JGLOBAL_PASSWORD'); ?>">
<?php endif; ?>
</div>
<?php if (PluginHelper::isEnabled('system', 'remember')) : ?>
<div class="mod-login__remember form-group">
<div id="form-login-remember-<?php echo $module->id; ?>" class="form-check">
<input type="checkbox" name="remember" class="form-check-input" value="yes" id="form-login-input-remember-<?php echo $module->id; ?>">
<label class="form-check-label" for="form-login-input-remember-<?php echo $module->id; ?>">
<?php echo Text::_('MOD_LOGIN_REMEMBER_ME'); ?>
</label>
</div>
</div>
<?php endif; ?>
<?php foreach ($extraButtons as $button) :
$dataAttributeKeys = array_filter(array_keys($button), function ($key) {
return substr($key, 0, 5) == 'data-';
});
?>
<div class="mod-login__submit 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="mod-login__submit form-group">
<button type="submit" name="Submit" class="btn btn-primary w-100"><?php echo Text::_('JLOGIN'); ?></button>
</div>
<?php
$usersConfig = ComponentHelper::getParams('com_users'); ?>
<ul class="mod-login__options list-unstyled">
<li>
<a href="<?php echo Route::_('index.php?option=com_users&view=reset'); ?>">
<?php echo Text::_('MOD_LOGIN_FORGOT_YOUR_PASSWORD'); ?></a>
</li>
<li>
<a href="<?php echo Route::_('index.php?option=com_users&view=remind'); ?>">
<?php echo Text::_('MOD_LOGIN_FORGOT_YOUR_USERNAME'); ?></a>
</li>
<?php if ($usersConfig->get('allowUserRegistration')) : ?>
<li>
<a href="<?php echo Route::_($registerLink); ?>">
<?php echo Text::_('MOD_LOGIN_REGISTER'); ?> <span class="icon-register" aria-hidden="true"></span></a>
</li>
<?php endif; ?>
</ul>
<input type="hidden" name="option" value="com_users">
<input type="hidden" name="task" value="user.login">
<input type="hidden" name="return" value="<?php echo $return; ?>">
<?php echo HTMLHelper::_('form.token'); ?>
</div>
<?php if ($params->get('posttext')) : ?>
<div class="mod-login__posttext posttext">
<p><?php echo $params->get('posttext'); ?></p>
</div>
<?php endif; ?>
</form>

View File

@ -0,0 +1,47 @@
<?php
/**
* @package Joomla.Site
* @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\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = \Joomla\CMS\Factory::getApplication()->getDocument()->getWebAssetManager();
$wa->useScript('keepalive');
?>
<form class="mod-login-logout form-vertical" action="<?php echo Route::_('index.php', true); ?>" method="post" id="login-form-<?php echo $module->id; ?>">
<?php if ($params->get('greeting', 1)) : ?>
<div class="mod-login-logout__login-greeting login-greeting">
<?php if (!$params->get('name', 0)) : ?>
<?php echo Text::sprintf('MOD_LOGIN_HINAME', htmlspecialchars($user->get('name'), ENT_COMPAT, 'UTF-8')); ?>
<?php else : ?>
<?php echo Text::sprintf('MOD_LOGIN_HINAME', htmlspecialchars($user->get('username'), ENT_COMPAT, 'UTF-8')); ?>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ($params->get('profilelink', 0)) : ?>
<ul class="mod-login-logout__options list-unstyled">
<li>
<a href="<?php echo Route::_('index.php?option=com_users&view=profile'); ?>">
<?php echo Text::_('MOD_LOGIN_PROFILE'); ?></a>
</li>
</ul>
<?php endif; ?>
<div class="mod-login-logout__button logout-button">
<button type="submit" name="Submit" class="btn btn-primary"><?php echo Text::_('JLOGOUT'); ?></button>
<input type="hidden" name="option" value="com_users">
<input type="hidden" name="task" value="user.logout">
<input type="hidden" name="return" value="<?php echo $return; ?>">
<?php echo HTMLHelper::_('form.token'); ?>
</div>
</form>