first commit
This commit is contained in:
54
administrator/components/com_users/tmpl/methods/default.php
Normal file
54
administrator/components/com_users/tmpl/methods/default.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_users
|
||||
*
|
||||
* @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// Prevent direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\Component\Users\Administrator\View\Methods\HtmlView;
|
||||
|
||||
/** @var HtmlView $this */
|
||||
?>
|
||||
<div id="com-users-methods-list">
|
||||
<div id="com-users-methods-reset-container" class="d-flex align-items-center border border-1 rounded-3 p-2">
|
||||
<div id="com-users-methods-reset-message" class="flex-grow-1">
|
||||
<?php echo Text::_('COM_USERS_MFA_LIST_STATUS_' . ($this->mfaActive ? 'ON' : 'OFF')) ?>
|
||||
</div>
|
||||
<?php if ($this->mfaActive) : ?>
|
||||
<div>
|
||||
<a href="<?php echo Route::_('index.php?option=com_users&task=methods.disable&' . Factory::getApplication()->getFormToken() . '=1' . ($this->returnURL ? '&returnurl=' . $this->escape(urlencode($this->returnURL)) : '') . '&user_id=' . $this->user->id) ?>"
|
||||
class="btn btn-danger btn-sm">
|
||||
<?php echo Text::_('COM_USERS_MFA_LIST_REMOVEALL'); ?>
|
||||
</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php if (!count($this->methods)) : ?>
|
||||
<div id="com-users-methods-list-instructions" class="alert alert-info mt-2">
|
||||
<span class="icon icon-info-circle" aria-hidden="true"></span>
|
||||
<?php echo Text::_('COM_USERS_MFA_LIST_INSTRUCTIONS'); ?>
|
||||
</div>
|
||||
<?php elseif ($this->isMandatoryMFASetup) : ?>
|
||||
<div class="alert alert-info my-3">
|
||||
<h3 class="alert-heading">
|
||||
<?php echo Text::_('COM_USERS_MFA_MANDATORY_NOTICE_HEAD') ?>
|
||||
</h3>
|
||||
<p>
|
||||
<?php echo Text::_('COM_USERS_MFA_MANDATORY_NOTICE_BODY') ?>
|
||||
</p>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
|
||||
<?php $this->setLayout('list');
|
||||
echo $this->loadTemplate(); ?>
|
||||
</div>
|
||||
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_users
|
||||
*
|
||||
* @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// Prevent direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\Component\Users\Administrator\View\Methods\HtmlView;
|
||||
|
||||
/** @var HtmlView $this */
|
||||
|
||||
$headingLevel = 2;
|
||||
?>
|
||||
<div id="com-users-methods-list">
|
||||
<?php if (!$this->isAdmin) : ?>
|
||||
<h<?php echo $headingLevel ?> id="com-users-methods-list-head">
|
||||
<?php echo Text::_('COM_USERS_MFA_FIRSTTIME_PAGE_HEAD'); ?>
|
||||
</h<?php echo $headingLevel++ ?>>
|
||||
<?php endif; ?>
|
||||
<div id="com-users-methods-list-instructions" class="alert alert-info">
|
||||
<h<?php echo $headingLevel ?> class="alert-heading">
|
||||
<span class="fa fa-shield-alt" aria-hidden="true"></span>
|
||||
<?php echo Text::_('COM_USERS_MFA_FIRSTTIME_INSTRUCTIONS_HEAD'); ?>
|
||||
</h<?php echo $headingLevel ?>>
|
||||
<p>
|
||||
<?php echo Text::_('COM_USERS_MFA_FIRSTTIME_INSTRUCTIONS_WHATITDOES'); ?>
|
||||
</p>
|
||||
<a href="<?php echo Route::_(
|
||||
'index.php?option=com_users&task=methods.doNotShowThisAgain' .
|
||||
($this->returnURL ? '&returnurl=' . $this->escape(urlencode($this->returnURL)) : '') .
|
||||
'&user_id=' . $this->user->id .
|
||||
'&' . Factory::getApplication()->getFormToken() . '=1'
|
||||
)?>"
|
||||
class="btn btn-danger w-100">
|
||||
<?php echo Text::_('COM_USERS_MFA_FIRSTTIME_NOTINTERESTED'); ?>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<?php $this->setLayout('list');
|
||||
echo $this->loadTemplate(); ?>
|
||||
</div>
|
||||
144
administrator/components/com_users/tmpl/methods/list.php
Normal file
144
administrator/components/com_users/tmpl/methods/list.php
Normal file
@ -0,0 +1,144 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_users
|
||||
*
|
||||
* @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// Prevent direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
use Joomla\Component\Users\Administrator\Helper\Mfa as MfaHelper;
|
||||
use Joomla\Component\Users\Administrator\Model\MethodsModel;
|
||||
use Joomla\Component\Users\Administrator\View\Methods\HtmlView;
|
||||
|
||||
/** @var HtmlView $this */
|
||||
|
||||
HTMLHelper::_('bootstrap.tooltip', '.hasTooltip');
|
||||
|
||||
/** @var MethodsModel $model */
|
||||
$model = $this->getModel();
|
||||
|
||||
$this->document->getWebAssetManager()->useScript('com_users.two-factor-list');
|
||||
|
||||
$canAddEdit = MfaHelper::canAddEditMethod($this->user);
|
||||
$canDelete = MfaHelper::canDeleteMethod($this->user);
|
||||
?>
|
||||
<div id="com-users-methods-list-container">
|
||||
<?php foreach ($this->methods as $methodName => $method) :
|
||||
$methodClass = 'com-users-methods-list-method-name-' . htmlentities($method['name'])
|
||||
. ($this->defaultMethod == $methodName ? ' com-users-methods-list-method-default' : '');
|
||||
?>
|
||||
<div class="com-users-methods-list-method <?php echo $methodClass?> <?php echo count($method['active']) ? 'com-users-methods-list-method-active' : '' ?>">
|
||||
<div class="com-users-methods-list-method-header">
|
||||
<div class="com-users-methods-list-method-image">
|
||||
<img src="<?php echo Uri::root() . $method['image'] ?>"
|
||||
alt="<?php echo $this->escape($method['display']) ?>"
|
||||
class="img-fluid"
|
||||
>
|
||||
</div>
|
||||
<div class="com-users-methods-list-method-title">
|
||||
<h3>
|
||||
<span class="me-1 flex-grow-1">
|
||||
<?php echo $method['display'] ?>
|
||||
</span>
|
||||
<?php if ($this->defaultMethod == $methodName) : ?>
|
||||
<span id="com-users-methods-list-method-default-tag" class="badge bg-info p-2 fs-4 me-1">
|
||||
<?php echo Text::_('COM_USERS_MFA_LIST_DEFAULTTAG') ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="com-users-methods-list-method-records-container">
|
||||
<div class="com-users-methods-list-method-info">
|
||||
<?php echo $method['shortinfo'] ?>
|
||||
</div>
|
||||
|
||||
<?php if (count($method['active'])) : ?>
|
||||
<div class="com-users-methods-list-method-records pt-2 my-2">
|
||||
<?php foreach ($method['active'] as $record) : ?>
|
||||
<div class="com-users-methods-list-method-record d-flex flex-row flex-wrap justify-content-start border-top py-2">
|
||||
<div class="com-users-methods-list-method-record-info flex-grow-1 d-flex flex-column align-items-start gap-1">
|
||||
<?php if ($methodName === 'backupcodes') : ?>
|
||||
<?php if ($canAddEdit) : ?>
|
||||
<div class="alert alert-info mt-1 w-100">
|
||||
<?php echo Text::sprintf('COM_USERS_MFA_BACKUPCODES_PRINT_PROMPT_HEAD', Route::_('index.php?option=com_users&task=method.edit&id=' . (int) $record->id . ($this->returnURL ? '&returnurl=' . $this->escape(urlencode($this->returnURL)) : '') . '&user_id=' . $this->user->id)) ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<?php else : ?>
|
||||
<h4 class="com-users-methods-list-method-record-title-container mb-1 fs-3">
|
||||
<?php if ($record->default) : ?>
|
||||
<span id="com-users-methods-list-method-default-badge-small"
|
||||
class="text-warning me-1 hasTooltip"
|
||||
title="<?php echo $this->escape(Text::_('COM_USERS_MFA_LIST_DEFAULTTAG')) ?>">
|
||||
<span class="icon icon-star" aria-hidden="true"></span>
|
||||
<span class="visually-hidden"><?php echo $this->escape(Text::_('COM_USERS_MFA_LIST_DEFAULTTAG')) ?></span>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<span class="com-users-methods-list-method-record-title fw-bold">
|
||||
<?php echo $this->escape($record->title); ?>
|
||||
</span>
|
||||
</h4>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="com-users-methods-list-method-record-lastused my-1 d-flex flex-row flex-wrap justify-content-start gap-5 text-muted w-100">
|
||||
<span class="com-users-methods-list-method-record-createdon">
|
||||
<?php echo Text::sprintf('COM_USERS_MFA_LBL_CREATEDON', $model->formatRelative($record->created_on)) ?>
|
||||
</span>
|
||||
<span class="com-users-methods-list-method-record-lastused-date">
|
||||
<?php echo Text::sprintf('COM_USERS_MFA_LBL_LASTUSED', $model->formatRelative($record->last_used)) ?>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php if ($methodName !== 'backupcodes' && ($canAddEdit || $canDelete)) : ?>
|
||||
<div class="com-users-methods-list-method-record-actions my-2 d-flex flex-row flex-wrap justify-content-center align-content-center align-items-start">
|
||||
<?php if ($canAddEdit) : ?>
|
||||
<a class="com-users-methods-list-method-record-edit btn btn-secondary btn-sm mx-1 hasTooltip"
|
||||
href="<?php echo Route::_('index.php?option=com_users&task=method.edit&id=' . (int) $record->id . ($this->returnURL ? '&returnurl=' . $this->escape(urlencode($this->returnURL)) : '') . '&user_id=' . $this->user->id)?>"
|
||||
title="<?php echo Text::_('JACTION_EDIT') ?> <?php echo $this->escape($record->title); ?>">
|
||||
<span class="icon icon-pencil" aria-hidden="true"></span>
|
||||
<span class="visually-hidden"><?php echo Text::_('JACTION_EDIT') ?> <?php echo $this->escape($record->title); ?></span>
|
||||
</a>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if ($method['canDisable'] && $canDelete) : ?>
|
||||
<a class="com-users-methods-list-method-record-delete btn btn-danger btn-sm mx-1 hasTooltip"
|
||||
href="<?php echo Route::_('index.php?option=com_users&task=method.delete&id=' . (int) $record->id . ($this->returnURL ? '&returnurl=' . $this->escape(urlencode($this->returnURL)) : '') . '&user_id=' . $this->user->id . '&' . Factory::getApplication()->getFormToken() . '=1')?>"
|
||||
title="<?php echo Text::_('JACTION_DELETE') ?> <?php echo $this->escape($record->title); ?>">
|
||||
<span class="icon icon-trash" aria-hidden="true"></span>
|
||||
<span class="visually-hidden"><?php echo Text::_('JACTION_DELETE') ?> <?php echo $this->escape($record->title); ?></span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($canAddEdit && (empty($method['active']) || $method['allowMultiple'])) : ?>
|
||||
<div class="com-users-methods-list-method-addnew-container border-top pt-2">
|
||||
<a href="<?php echo Route::_('index.php?option=com_users&task=method.add&method=' . $this->escape(urlencode($method['name'])) . ($this->returnURL ? '&returnurl=' . $this->escape(urlencode($this->returnURL)) : '') . '&user_id=' . $this->user->id)?>"
|
||||
class="com-users-methods-list-method-addnew btn btn-primary btn-sm"
|
||||
>
|
||||
<span class="icon-plus-2" aria-hidden="true"></span>
|
||||
<?php echo Text::sprintf('COM_USERS_MFA_ADD_AUTHENTICATOR_OF_TYPE', $method['display']) ?>
|
||||
</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
Reference in New Issue
Block a user