CoreFiles by mySites.guru
MethodController.php55 lines, 1,358 bytes, from Joomla_6.2.0-beta3-Beta-Full_Package.zip
Raw History Compare with 6.2.0-beta2
md5
a4b5db349ea18bd065f5fefe8229f350
sha1
7a6c202e905bb03fa6f602acb32d218807703720
sha256
b04e23fcae656453ec4f07c9f47aeedd589373d2bad0709adc0bd231a49d2c13
<?php

/**
 * @package     Joomla.Site
 * @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
 */

namespace Joomla\Component\Users\Site\Controller;

use Joomla\CMS\Router\Route;
use Joomla\Component\Users\Administrator\Controller\MethodController as AdminMethodController;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
 * Multi-factor Authentication method controller
 *
 * @since 4.2.0
 */
class MethodController extends AdminMethodController
{
    /**
     * Execute a task by triggering a Method in the derived class.
     *
     * @param   string  $task    The task to perform.
     *
     * @return  mixed   The value returned by the called Method.
     *
     * @throws  \Exception
     * @since   4.2.0
     */
    public function execute($task)
    {
        try {
            return parent::execute($task);
        } catch (\Exception $e) {
            if ($e->getCode() !== 403) {
                throw $e;
            }

            if ($this->app->getIdentity()->guest) {
                $this->setRedirect(Route::_('index.php?option=com_users&view=login', false));

                return null;
            }
        }

        return null;
    }
}

The same content is in 98 releases, Joomla 5.2.4-rc1 to 6.2.1-rc1. See them all, or every version of this file.