CoreFiles by mySites.guru
MethodController.php51 lines, 1,260 bytes, from Joomla_4.2.0-beta3-Beta-Full_Package.zip
Raw History Compare with 4.2.0-beta2
md5
4e523e6396404b363b0d8a3f240c0497
sha1
a972e1efa59c77442af83f496b97b71d9a09a419
sha256
9bac981b0db77f3c2fd37662f1b735b5a85ff21d0843dad10c5477a4675cd65c
<?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
 */

namespace Joomla\Component\Users\Site\Controller;

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

/**
 * 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 5 releases, Joomla 4.2.0-beta3 to 4.2.1-rc2. See them all, or every version of this file.