dolibarr 23.0.3
login.controller.class.php
Go to the documentation of this file.
1<?php
2/*
3 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
28{
34 public function checkAccess()
35 {
36 $this->accessRight = true;
38 return !$context->userIslog();
39 }
40
47 public function action()
48 {
49 global $langs;
51 if (!$context->controllerInstance->checkAccess()) {
52 return -1;
53 }
54
55 $hookRes = $this->hookDoAction();
56 if (empty($hookRes)) {
57 $context->title = $langs->trans('WebPortalHomeTitle');
58 $context->desc = $langs->trans('WebPortalHomeDesc');
59 //$context->doNotDisplayHeaderBar=1;// hide default header
60 }
61
62 return 1;
63 }
64
70 public function display()
71 {
73 if (!$context->controllerInstance->checkAccess()) {
74 $this->display404();
75 return;
76 }
77
78 $this->loadTemplate('header_login');
79
80 $hookRes = $this->hookPrintPageView();
81
82 if (empty($hookRes)) {
83 $this->loadTemplate('login');
84 }
85
86 $this->loadTemplate('footer');
87 }
88}
static getInstance()
Singleton method to create one instance of this object.
Class to manage pages.
hookPrintPageView($parameters=array())
Execute hook PrintPageView.
display404()
Display error template.
hookDoAction($parameters=array())
Execute hook doActions.
loadTemplate($templateName, $vars=false)
Load a template .tpl file.
Class for LoginController.
display()
Display the login page.
checkAccess()
Check current access to controller.
action()
Action method is called before html output can be used to manage security and change context.
$context
@method int call_trigger(string $triggerName, ?User $user)
Definition logout.php:42