diff --git a/front/helpdesk.html b/front/helpdesk.html deleted file mode 100644 index 86bd31b6adc..00000000000 --- a/front/helpdesk.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - Helpdesk - - - - - \ No newline at end of file diff --git a/front/helpdesk.public.php b/front/helpdesk.public.php deleted file mode 100644 index 66792f5c661..00000000000 --- a/front/helpdesk.public.php +++ /dev/null @@ -1,111 +0,0 @@ -. - * - * --------------------------------------------------------------------- - */ - -use Glpi\Application\View\TemplateRenderer; - -/** @var array $CFG_GLPI */ -global $CFG_GLPI; - -// Redirect management -if (isset($_GET["redirect"])) { - Toolbox::manageRedirect($_GET["redirect"]); -} - -// redirect if no create ticket right -if ( - !Session::haveRight('ticket', CREATE) - && !Session::haveRight('reminder_public', READ) - && !Session::haveRight("rssfeed_public", READ) -) { - if ( - Session::haveRight('followup', ITILFollowup::SEEPUBLIC) - || Session::haveRight('task', TicketTask::SEEPUBLIC) - || Session::haveRightsOr('ticketvalidation', [TicketValidation::VALIDATEREQUEST, - TicketValidation::VALIDATEINCIDENT - ]) - ) { - Html::redirect($CFG_GLPI['root_doc'] . "/front/ticket.php"); - } else if (Session::haveRightsOr('reservation', [READ, ReservationItem::RESERVEANITEM])) { - Html::redirect($CFG_GLPI['root_doc'] . "/front/reservationitem.php"); - } else if (Session::haveRight('knowbase', KnowbaseItem::READFAQ)) { - Html::redirect($CFG_GLPI['root_doc'] . "/front/helpdesk.faq.php"); - } -} - -Html::helpHeader(__('Home')); - -$password_alert = ""; -$user = new User(); -$user->getFromDB(Session::getLoginUserID()); - -$ticket_summary = ""; -$survey_list = ""; -if (Session::haveRight('ticket', CREATE)) { - $ticket_summary = Ticket::showCentralCount(true, false); - $survey_list = Ticket::showCentralList(0, "survey", false, false); -} - -$reminder_list = ""; -if (Session::haveRight("reminder_public", READ)) { - $reminder_list = Reminder::showListForCentral(false, false); -} - -$rss_feed = ""; -if (Session::haveRight("rssfeed_public", READ)) { - $rss_feed = RSSFeed::showListForCentral(false, false); -} - -$kb_popular = ""; -$kb_recent = ""; -$kb_lastupdate = ""; -if (Session::haveRight('knowbase', KnowbaseItem::READFAQ)) { - $kb_popular = KnowbaseItem::showRecentPopular("popular", false); - $kb_recent = KnowbaseItem::showRecentPopular("recent", false); - $kb_lastupdate = KnowbaseItem::showRecentPopular("lastupdate", false); -} - -Html::requireJs('masonry'); -TemplateRenderer::getInstance()->display('pages/self-service/home.html.twig', [ - 'password_alert' => $user->getPasswordExpirationMessage(), - 'ticket_summary' => $ticket_summary, - 'survey_list' => $survey_list, - 'reminder_list' => $reminder_list, - 'rss_feed' => $rss_feed, - 'kb_popular' => $kb_popular, - 'kb_recent' => $kb_recent, - 'kb_lastupdate' => $kb_lastupdate, -]); - -Html::helpFooter(); diff --git a/front/tracking.injector.php b/front/tracking.injector.php deleted file mode 100644 index bebb6c5bd14..00000000000 --- a/front/tracking.injector.php +++ /dev/null @@ -1,109 +0,0 @@ -. - * - * --------------------------------------------------------------------- - */ - -/** - * @var array $CFG_GLPI - */ -global $CFG_GLPI; - -if ( - empty($_POST["_type"]) - || ($_POST["_type"] != "Helpdesk") - || !$CFG_GLPI["use_anonymous_helpdesk"] -) { - Session::checkRight("ticket", CREATE); -} - -$track = new Ticket(); - -// Security check -if (empty($_POST) || (count($_POST) == 0)) { - Html::redirect($CFG_GLPI["root_doc"] . "/front/helpdesk.public.php"); -} - -if (isset($_POST["_type"]) && ($_POST["_type"] == "Helpdesk")) { - Html::nullHeader(Ticket::getTypeName(Session::getPluralNumber())); -} else if ($_POST["_from_helpdesk"]) { - Html::helpHeader(__('Simplified interface')); -} else { - Html::header(__('Simplified interface'), '', $_SESSION["glpiname"], "helpdesk", "tracking"); -} - -if (isset($_POST['_actors']) && is_string($_POST['_actors'])) { - try { - $_POST['_actors'] = json_decode($_POST['_actors'], true, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $e) { - $_POST['_actors'] = []; - } -} -if (isset($_POST['add'])) { - if (!$CFG_GLPI["use_anonymous_helpdesk"]) { - $track->check(-1, CREATE, $_POST); - } else { - $track->getEmpty(); - } - $_POST['check_delegatee'] = true; - if (isset($_POST['_actors'])) { - // with self-service, we only have observers - unset($_POST['_actors']['requester'], $_POST['_actors']['assign']); - } - if ($track->add($_POST)) { - if ($_SESSION['glpibackcreated'] && Ticket::canView()) { - Html::redirect($track->getLinkURL()); - } - if (isset($_POST["_type"]) && ($_POST["_type"] == "Helpdesk")) { - echo "
" . - __s('Your ticket has been registered, its treatment is in progress.'); - Html::displayBackLink(); - echo "
"; - } else { - echo "
"; - echo "" . __s("; - Session::addMessageAfterRedirect(__s('Thank you for using our automatic helpdesk system.')); - Html::displayMessageAfterRedirect(); - echo "
"; - } - } else { - if (isset($_POST["_type"]) && ($_POST["_type"] == "Helpdesk")) { - Html::redirect($CFG_GLPI["root_doc"] . "/front/helpdesk.php"); - } else { - Html::redirect($CFG_GLPI["root_doc"] . "/ServiceCatalog"); - } - } - Html::nullFooter(); -} else { // reload display form - $track->showFormHelpdesk(Session::getLoginUserID()); - Html::helpFooter(); -} diff --git a/phpunit/functional/Glpi/Http/FirewallTest.php b/phpunit/functional/Glpi/Http/FirewallTest.php index 48ada4fda7f..d7f5b4431b4 100644 --- a/phpunit/functional/Glpi/Http/FirewallTest.php +++ b/phpunit/functional/Glpi/Http/FirewallTest.php @@ -69,7 +69,6 @@ public function testComputeFallbackStrategy(): void 'cron.php' => '', 'css.php' => '', 'document.send.php' => '', - 'helpdesk.php' => '', 'helpdesk.faq.php' => '', 'inventory.php' => '', 'locale.php' => '', @@ -200,13 +199,11 @@ public function testComputeFallbackStrategy(): void '/front/cron.php', '/front/css.php', '/front/document.send.php', - '/front/helpdesk.php', '/front/inventory.php', '/front/locale.php', '/front/login.php', '/front/logout.php', '/front/lostpassword.php', - '/front/tracking.injector.php', '/front/updatepassword.php', ]; foreach ($legacy_no_check_urls as $no_check_url) { diff --git a/phpunit/functional/Glpi/Http/RedirectLegacyRouteListenerTest.php b/phpunit/functional/Glpi/Http/RedirectLegacyRouteListenerTest.php new file mode 100644 index 00000000000..7f41f57b134 --- /dev/null +++ b/phpunit/functional/Glpi/Http/RedirectLegacyRouteListenerTest.php @@ -0,0 +1,85 @@ +. + * + * --------------------------------------------------------------------- + */ + +namespace tests\units\Glpi\Http; + +use Glpi\Http\RedirectLegacyRouteListener; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Event\RequestEvent; +use Symfony\Component\HttpKernel\HttpKernelInterface; +use Symfony\Component\HttpKernel\KernelInterface; + +final class RedirectLegacyRouteListenerTest extends TestCase +{ + public static function provideLegacyUrl(): iterable + { + foreach (['', '/glpi', '/support/glpi'] as $root_doc) { + yield [ + 'root_doc' => $root_doc, + 'path' => $root_doc . '/front/helpdesk.public.php', + 'expected' => $root_doc . '/Helpdesk', + ]; + + yield [ + 'root_doc' => $root_doc, + 'path' => $root_doc . '/front/not.redirected.php', + 'expected' => null, + ]; + } + } + + #[DataProvider('provideLegacyUrl')] + public function testRedirection(string $root_doc, string $path, ?string $expected): void + { + $request = new Request(); + $request->server->set('SCRIPT_FILENAME', $root_doc . '/index.php'); + $request->server->set('SCRIPT_NAME', $root_doc . '/index.php'); + $request->server->set('REQUEST_URI', $path); + + $event = new RequestEvent($this->createMock(KernelInterface::class), $request, HttpKernelInterface::MAIN_REQUEST); + + $listener = new RedirectLegacyRouteListener(); + $listener->onKernelRequest($event); + + if ($expected === null) { + $this->assertNull($event->getResponse()); + } else { + $this->assertInstanceOf(RedirectResponse::class, $event->getResponse()); + $this->assertEquals($expected, $event->getResponse()->getTargetUrl()); + } + } +} diff --git a/src/Auth.php b/src/Auth.php index e09a29a22da..08d8b99aed7 100644 --- a/src/Auth.php +++ b/src/Auth.php @@ -1557,7 +1557,7 @@ public static function redirectIfAuthenticated($redirect = null) if ($_SESSION['glpiactiveprofile']['create_ticket_on_login']) { Html::redirect($CFG_GLPI['root_doc'] . "/ServiceCatalog"); } - Html::redirect($CFG_GLPI['root_doc'] . "/front/helpdesk.public.php"); + Html::redirect($CFG_GLPI['root_doc'] . "/Helpdesk"); } else { if ($_SESSION['glpiactiveprofile']['create_ticket_on_login']) { Html::redirect(Ticket::getFormURL()); diff --git a/src/Glpi/Application/View/Extension/RoutingExtension.php b/src/Glpi/Application/View/Extension/RoutingExtension.php index a6c53be0033..676b4e5af4d 100644 --- a/src/Glpi/Application/View/Extension/RoutingExtension.php +++ b/src/Glpi/Application/View/Extension/RoutingExtension.php @@ -71,7 +71,7 @@ public function indexPath(): string $index = '/index.php'; if (Session::getLoginUserID() !== false) { $index = Session::getCurrentInterface() == 'helpdesk' - ? 'front/helpdesk.public.php' + ? 'Helpdesk' : 'front/central.php'; } return Html::getPrefixedUrl($index); diff --git a/src/Glpi/Controller/SelfService/HomeController.php b/src/Glpi/Controller/Helpdesk/IndexController.php similarity index 84% rename from src/Glpi/Controller/SelfService/HomeController.php rename to src/Glpi/Controller/Helpdesk/IndexController.php index c150f882d42..7e2fe97225a 100644 --- a/src/Glpi/Controller/SelfService/HomeController.php +++ b/src/Glpi/Controller/Helpdesk/IndexController.php @@ -32,7 +32,7 @@ * --------------------------------------------------------------------- */ -namespace Glpi\Controller\SelfService; +namespace Glpi\Controller\Helpdesk; use Glpi\Controller\AbstractController; use Glpi\Helpdesk\Tile\TilesManager; @@ -42,8 +42,10 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Attribute\Route; +use User; +use Session; -final class HomeController extends AbstractController +final class IndexController extends AbstractController { private TilesManager $tiles_manager; @@ -54,19 +56,22 @@ public function __construct() #[SecurityStrategy(Firewall::STRATEGY_HELPDESK_ACCESS)] #[Route( - "/Home", - name: "glpi_selfservice_home", + "/Helpdesk", + name: "glpi_helpdesk_index", methods: "GET" )] public function __invoke(Request $request): Response { + $user = User::getById(Session::getLoginUserID()); + // Will rename the file to "home.html.twig" later, don't want to remove // the original file yet. - return $this->render('pages/self-service/new_home.html.twig', [ + return $this->render('pages/helpdesk/index.html.twig', [ 'title' => __("Home"), 'menu' => ['helpdesk-home'], 'tiles' => $this->tiles_manager->getTiles(), 'tabs' => new HomePageTabs(), + 'password_alert' => $user->getPasswordExpirationMessage(), ]); } } diff --git a/src/Glpi/Controller/Session/ChangeProfileController.php b/src/Glpi/Controller/Session/ChangeProfileController.php index 62b6b0526c0..63b50abcac1 100644 --- a/src/Glpi/Controller/Session/ChangeProfileController.php +++ b/src/Glpi/Controller/Session/ChangeProfileController.php @@ -70,7 +70,7 @@ public function __invoke(Request $request): Response // Compute redirection URL if (Session::getCurrentInterface() == "helpdesk") { $go_to_create_ticket = $_SESSION['glpiactiveprofile']['create_ticket_on_login']; - $route = $go_to_create_ticket ? "/ServiceCatalog" : "/Home"; + $route = $go_to_create_ticket ? "/ServiceCatalog" : "/Helpdesk"; $redirect = $request->getBasePath() . $route; } else { $_SESSION['_redirected_from_profile_selector'] = true; diff --git a/src/Glpi/Helpdesk/Tile/TilesManager.php b/src/Glpi/Helpdesk/Tile/TilesManager.php index baeb3d8df32..442b1d8330c 100644 --- a/src/Glpi/Helpdesk/Tile/TilesManager.php +++ b/src/Glpi/Helpdesk/Tile/TilesManager.php @@ -83,9 +83,9 @@ public function getTiles(): array title: __("View RSS feeds"), description: __("Checkout new data from your saved RSS feeds."), illustration: "view-feed.svg", - // TODO: create dedicated RSS page, the only place they are - // visible is on the dashboard of the legacy home page. - link: "/front/helpdesk.public.php" + // TODO: replace this default tile by something more useful, rss + // feeds are already displayed on the home page using a tab + link: "/Helpdesk" ); return $tiles; diff --git a/src/Glpi/Http/Firewall.php b/src/Glpi/Http/Firewall.php index 447aec61b9c..d9dff66bba2 100644 --- a/src/Glpi/Http/Firewall.php +++ b/src/Glpi/Http/Firewall.php @@ -211,13 +211,11 @@ private function computeFallbackStrategyForCore(string $path): string '/front/cron.php' => self::STRATEGY_NO_CHECK, // in GLPI mode, cronjob can also be triggered from public pages '/front/css.php' => self::STRATEGY_NO_CHECK, // CSS must be accessible also on public pages '/front/document.send.php' => self::STRATEGY_NO_CHECK, // may allow unauthenticated access, for public FAQ images - '/front/helpdesk.php' => self::STRATEGY_NO_CHECK, // Anonymous access may be allowed by configuration. '/front/inventory.php' => self::STRATEGY_NO_CHECK, // allow anonymous requests from inventory agent '/front/locale.php' => self::STRATEGY_NO_CHECK, // locales must be accessible also on public pages '/front/login.php' => self::STRATEGY_NO_CHECK, '/front/logout.php' => self::STRATEGY_NO_CHECK, '/front/lostpassword.php' => self::STRATEGY_NO_CHECK, - '/front/tracking.injector.php' => self::STRATEGY_NO_CHECK, // Anonymous access may be allowed by configuration. '/front/updatepassword.php' => self::STRATEGY_NO_CHECK, '/install/' => self::STRATEGY_NO_CHECK, // No check during install/update ]; diff --git a/src/Glpi/Http/ListenersPriority.php b/src/Glpi/Http/ListenersPriority.php index 8c59c0e5157..18cbb7925bd 100644 --- a/src/Glpi/Http/ListenersPriority.php +++ b/src/Glpi/Http/ListenersPriority.php @@ -45,6 +45,10 @@ final class ListenersPriority LegacyRouterListener::class => 400, + // Legacy URLs redirections does not require any complex logic. It can be done prior to + // GLPI config and plugins initialization. + RedirectLegacyRouteListener::class => 375, + // Config providers may still expect some `$_SERVER` variables to be redefined. // They must therefore be executed after the `LegacyRouterListener`. LegacyConfigProviderListener::class => 350, diff --git a/front/helpdesk.php b/src/Glpi/Http/RedirectLegacyRouteListener.php similarity index 52% rename from front/helpdesk.php rename to src/Glpi/Http/RedirectLegacyRouteListener.php index df2c4447cce..8e12b18b339 100644 --- a/front/helpdesk.php +++ b/src/Glpi/Http/RedirectLegacyRouteListener.php @@ -8,7 +8,6 @@ * http://glpi-project.org * * @copyright 2015-2024 Teclib' and contributors. - * @copyright 2003-2014 by the INDEPNET Development Team. * @licence https://www.gnu.org/licenses/gpl-3.0.html * * --------------------------------------------------------------------- @@ -33,16 +32,35 @@ * --------------------------------------------------------------------- */ -/** - * @var array $CFG_GLPI - */ -global $CFG_GLPI; +namespace Glpi\Http; -if ((int)$CFG_GLPI['use_anonymous_helpdesk'] === 0) { - Html::redirect($CFG_GLPI["root_doc"] . "/front/central.php"); -} +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\HttpKernel\Event\RequestEvent; +use Symfony\Component\HttpKernel\KernelEvents; + +final readonly class RedirectLegacyRouteListener implements EventSubscriberInterface +{ + private const URLS_MAPPING = [ + '/front/helpdesk.public.php' => '/Helpdesk', + ]; -Glpi\Application\View\TemplateRenderer::getInstance()->display('anonymous_helpdesk.html.twig', [ - 'card_md_width' => true, - 'title' => "Helpdesk", -]); + public static function getSubscribedEvents(): array + { + return [ + KernelEvents::REQUEST => ['onKernelRequest', ListenersPriority::LEGACY_LISTENERS_PRIORITIES[self::class]], + ]; + } + + public function onKernelRequest(RequestEvent $event): void + { + if (!$event->isMainRequest()) { + return; + } + $request = $event->getRequest(); + + if (\array_key_exists($request->getPathInfo(), self::URLS_MAPPING)) { + $event->setResponse(new RedirectResponse($request->getBasePath() . self::URLS_MAPPING[$request->getPathInfo()])); + } + } +} diff --git a/src/Html.php b/src/Html.php index 31aed6c15c3..0492ce39c38 100644 --- a/src/Html.php +++ b/src/Html.php @@ -1481,7 +1481,7 @@ public static function generateHelpMenu() $menu = [ 'home' => [ - 'default' => '/front/helpdesk.public.php', + 'default' => '/Helpdesk', 'title' => __('Home'), 'icon' => 'fas fa-home', ], diff --git a/src/Ticket.php b/src/Ticket.php index cfdacc396e7..e12a99390cd 100644 --- a/src/Ticket.php +++ b/src/Ticket.php @@ -1495,29 +1495,6 @@ public function prepareInputForAdd($input) return false; } - // Check a self-service user can create a ticket for another user. - // We condition the check with a bool flag set in front/tracking.injector.php (self-service ticket controller). - // This to avoid plugins having their process broken. - if ( - isset($input['check_delegatee'], $input['_users_id_requester']) - && $input['check_delegatee'] - ) { - $requesters_ids = is_array($input['_users_id_requester']) - ? $input['_users_id_requester'] - : [$input['_users_id_requester']]; - $can_delegatee_create_ticket = false; - foreach ($requesters_ids as $requester_id) { - if (self::canDelegateeCreateTicket($requester_id, ($input['entities_id'] ?? -2))) { - $can_delegatee_create_ticket = true; - break; - } - } - if (!$can_delegatee_create_ticket) { - Session::addMessageAfterRedirect(__s("You cannot create a ticket for this user")); - return false; - } - } - if (!isset($input["requesttypes_id"])) { $input["requesttypes_id"] = RequestType::getDefault('helpdesk'); } diff --git a/src/Toolbox.php b/src/Toolbox.php index 15dfe7aa23a..d6a7a4e6f3b 100644 --- a/src/Toolbox.php +++ b/src/Toolbox.php @@ -1502,7 +1502,7 @@ public static function manageRedirect($where) if ($matches[1] !== $CFG_GLPI['url_base']) { Session::addMessageAfterRedirect(__s('Redirection failed')); if (Session::getCurrentInterface() === "helpdesk") { - Html::redirect($CFG_GLPI["root_doc"] . "/front/helpdesk.public.php"); + Html::redirect($CFG_GLPI["root_doc"] . "/Helpdesk"); } else { Html::redirect($CFG_GLPI["root_doc"] . "/front/central.php"); } @@ -1566,7 +1566,7 @@ public static function manageRedirect($where) } } - Html::redirect($CFG_GLPI["root_doc"] . "/front/helpdesk.public.php"); + Html::redirect($CFG_GLPI["root_doc"] . "/Helpdesk"); // phpcs doesn't understand that the script will exit here so we need a comment to avoid the fallthrough warning case "preference": @@ -1578,7 +1578,7 @@ public static function manageRedirect($where) // phpcs doesn't understand that the script will exit here so we need a comment to avoid the fallthrough warning default: - Html::redirect($CFG_GLPI["root_doc"] . "/front/helpdesk.public.php"); + Html::redirect($CFG_GLPI["root_doc"] . "/Helpdesk"); } // @phpstan-ignore deadCode.unreachable (defensive programming) break; diff --git a/templates/anonymous_helpdesk.html.twig b/templates/anonymous_helpdesk.html.twig deleted file mode 100644 index 71a4a70dfe4..00000000000 --- a/templates/anonymous_helpdesk.html.twig +++ /dev/null @@ -1,75 +0,0 @@ -{# - # --------------------------------------------------------------------- - # - # GLPI - Gestionnaire Libre de Parc Informatique - # - # http://glpi-project.org - # - # @copyright 2015-2024 Teclib' and contributors. - # @copyright 2003-2014 by the INDEPNET Development Team. - # @licence https://www.gnu.org/licenses/gpl-3.0.html - # - # --------------------------------------------------------------------- - # - # LICENSE - # - # This file is part of GLPI. - # - # This program is free software: you can redistribute it and/or modify - # it under the terms of the GNU General Public License as published by - # the Free Software Foundation, either version 3 of the License, or - # (at your option) any later version. - # - # This program is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - # GNU General Public License for more details. - # - # You should have received a copy of the GNU General Public License - # along with this program. If not, see . - # - # --------------------------------------------------------------------- - #} - -{% extends 'layout/page_card_notlogged.html.twig' %} - -{% block content_block %} -
- - - - -

{{ __('Helpdesk reporting form') }}

- -
- - -
- - {{ __('Describe your issue') }} -
-
- - -
- -
- - -
-
- - -
-{% endblock %} diff --git a/templates/components/itilobject/mainform_open.html.twig b/templates/components/itilobject/mainform_open.html.twig index b9a9e380a4e..f573faa5d65 100644 --- a/templates/components/itilobject/mainform_open.html.twig +++ b/templates/components/itilobject/mainform_open.html.twig @@ -39,10 +39,6 @@ {% set form_path = form_path ~ '?id=' ~ item.fields['id'] %} {% endif %} -{% if selfservice %} - {% set form_path = path('front/tracking.injector.php') %} -{% endif %} - {% set track_changes = 'true' %} {% if item.isNewItem() %} {% set track_changes = 'false' %} diff --git a/templates/pages/self-service/new_home.html.twig b/templates/pages/helpdesk/index.html.twig similarity index 76% rename from templates/pages/self-service/new_home.html.twig rename to templates/pages/helpdesk/index.html.twig index fb9f43b4323..67e7dbe6fd8 100644 --- a/templates/pages/self-service/new_home.html.twig +++ b/templates/pages/helpdesk/index.html.twig @@ -56,6 +56,31 @@
+ {# Display password alerts #} + {% if password_alert|length %} + + {% endif %} + + {# TODO: deprecate this hook and make a new one that doesn't expect a table as a container #} + + {{ call_plugin_hook(constant('Glpi\\Plugin\\Hooks::DISPLAY_CENTRAL')) }} +
+
{% for tile in tiles %}
diff --git a/templates/pages/self-service/home.html.twig b/templates/pages/self-service/home.html.twig deleted file mode 100644 index 87c690bbe87..00000000000 --- a/templates/pages/self-service/home.html.twig +++ /dev/null @@ -1,75 +0,0 @@ -{# - # --------------------------------------------------------------------- - # - # GLPI - Gestionnaire Libre de Parc Informatique - # - # http://glpi-project.org - # - # @copyright 2015-2024 Teclib' and contributors. - # @copyright 2003-2014 by the INDEPNET Development Team. - # @licence https://www.gnu.org/licenses/gpl-3.0.html - # - # --------------------------------------------------------------------- - # - # LICENSE - # - # This file is part of GLPI. - # - # This program is free software: you can redistribute it and/or modify - # it under the terms of the GNU General Public License as published by - # the Free Software Foundation, either version 3 of the License, or - # (at your option) any later version. - # - # This program is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - # GNU General Public License for more details. - # - # You should have received a copy of the GNU General Public License - # along with this program. If not, see . - # - # --------------------------------------------------------------------- - #} - -{% if password_alert|length %} - -{% endif %} - - - {{ call_plugin_hook(constant('Glpi\\Plugin\\Hooks::DISPLAY_CENTRAL')) }} -
- -{% set optional_grid_item_keys = [ - 'survey_list', 'reminder_list', 'rss_feed', 'kb_popular', 'kb_recent', 'kb_lastupdate' -] %} -{% set grid_items = [ - ticket_summary -] %} - -{% for optional_grid_item_key in optional_grid_item_keys %} - {% set item_content = _context[optional_grid_item_key] %} - {% if item_content is not empty %} - {% set grid_items = grid_items|merge([ - '
' ~ item_content ~ '
' - ]) %} - {% endif %} -{% endfor %} - -{{ include('components/masonry_grid.html.twig', { - 'grid_items': grid_items, -}, with_context = false) }} diff --git a/tests/cypress/e2e/self-service/home.cy.js b/tests/cypress/e2e/self-service/home.cy.js index d701ef1f7ae..56e10c509ae 100644 --- a/tests/cypress/e2e/self-service/home.cy.js +++ b/tests/cypress/e2e/self-service/home.cy.js @@ -37,7 +37,7 @@ describe('Helpdesk home page', () => { cy.changeProfile('Self-Service'); }); it('can use tiles', () => { - cy.visit('/Home'); + cy.visit('/Helpdesk'); cy.findByRole('region', { name: 'Quick Access' }) .findAllByRole('link') .as('tiles'); @@ -87,7 +87,7 @@ describe('Helpdesk home page', () => { 'reminders_id': reminder_id, }).as('reminder_id'); }); - cy.visit('/Home'); + cy.visit('/Helpdesk'); // Default tab should be opened tickets cy.findAllByText('Open ticket 1').should('be.visible'); diff --git a/tests/cypress/e2e/session.cy.js b/tests/cypress/e2e/session.cy.js index 9b3f7961807..5b1b2ea4a59 100644 --- a/tests/cypress/e2e/session.cy.js +++ b/tests/cypress/e2e/session.cy.js @@ -48,9 +48,9 @@ describe("Session", () => { cy.findByRole('checkbox', {name: "Remember me"}).check(); cy.getDropdownByLabelText("Login source").selectDropdownValue('GLPI internal database'); - // Submit, the url should now contain /front/central.php or /front/helpdesk.public.php + // After logging in, the url should contain /front/central.php or /Helpdesk cy.findByRole('button', {name: "Sign in"}).click(); - cy.url().should('match', /\/front\/(central|helpdesk.public).php/); + cy.url().should('match', /(\/front\/central.php|\/Helpdesk)/); // Validate cookies cy.getCookies().should('have.length.gte', 2).then((cookies) => {