User Authentication
Relevant source files
The following files were used as context for generating this wiki page:The user authentication system in this project provides the foundational structure for a login page, session management, and UI adjustments for unauthenticated users. The core logic is centered around login.php, which handles page rendering and session initialization. The actual authentication mechanism (e.g., password verification, database interaction) is not present in the analyzed files. The system is primarily concerned with rendering the login interface and ensuring other UI components, like the main navigation bar, are hidden on authentication-related pages.
The cookie policy mentions a "User Protect system developed by Institute Itech to ensure security, traceability, and browsing protection," but its implementation details are not available in the provided source files. The system relies on standard PHP sessions to manage user state across the application.
Sources: login.php, apps/translations.json:20-24
System Architecture
The authentication page is rendered through a simple PHP-based routing and templating system. A request to login.php initiates a session, determines which page template to load, and controls the visibility of shared UI components like the navigation bar.
Login Page Request Flow
The following diagram illustrates the server-side process when a user accesses the login page.
This diagram shows the sequence of operations within login.php from receiving a request to sending the final HTML response.
Sources: login.php:2-31
Component Interaction
The login feature is a collaboration between server-side PHP, client-side JavaScript, and CSS for styling.
This diagram shows the relationship between the main files involved in rendering and managing the login page.
Sources: login.php, apps/js/iite_components.js:40-50, themes/css/design.css:1228-1249
Core Components
Server-Side: login.php
This file is the entry point for the login page. Its primary responsibilities are:
- Session Initialization: It starts or resumes a user session using
session_start(). This is fundamental for maintaining state. - Language Handling: It detects a
langquery parameter to set the user's language preference in the session. - Template Rendering: It uses output buffering (
ob_start(),ob_get_clean()) to include thelogin.phtmlview within a globallayout.phtml. - UI Control: It sets a
$hideNavbarvariable totrue, which signals to the main layout file that the navigation bar should not be rendered.
Sources: login.php:2-31
Client-Side: iite_components.js
This JavaScript file provides a client-side fallback mechanism to ensure the navigation bar is hidden on the login page. This can prevent the navbar from briefly flashing on the screen before the server-rendered page is fully loaded.
It checks the window.location.pathname against a list of paths where the navbar should be hidden.
// apps/js/iite_components.js
// Pages where the navbar should be hidden (fallback to avoid brief flash while server-side loads)
const hideNavPages = [
'/login',
'/login.php',
];
// If the path matches any hideNavPages pattern, hide the nav as a client-side fallback
const shouldHideNav = hideNavPages.some(page => path.includes(page));
if (shouldHideNav) {
// The layout.phtml will handle server-side hiding, but this is a safe client-side fallback
const nav = document.getElementById('navbar');
if (nav) nav.style.display = 'none';
// Also hide any mobile navbar container if present
const containerMenuNav = document.getElementById('container-menu-nav');
if (containerMenuNav) containerMenuNav.style.display = 'none';
}
Sources: apps/js/iite_components.js:40-50
Styling: design.css
The visual appearance of the login page is defined in this stylesheet. It sets a full-screen background image and centers a container for the login form.
| CSS Selector | Description |
|---|---|
.background-page-login | Applies a background image and centers its content for the main login view. |
.container-form-login | Defines the dimensions and white background of the login form box. |
.container-form-login > form > h5 | Styles the title text inside the login form. |
Sources: themes/css/design.css:1228-1249
Key Features
Session Management
Sessions are used globally across the application to maintain user state. Every main PHP entry point, including index.php and login.php, begins with session_start(). This ensures that session data, such as language preference and presumably authentication status, is available on every page.
Sources: login.php:2, index.php:2
Dynamic UI Control
The application employs both server-side and client-side logic to hide the main navigation bar on specific pages, most notably the login page.
Server-Side Control
In login.php, a $hideNavbar flag is explicitly set to true. This flag is likely checked within the main layout.phtml file to conditionally render the navbar element.
// login.php
// Centralized list of pages (or route names) where we want to hide the navbar
$hideNavbarPages = [
'login',
'auth',
// add other internal routes or page names here
];
// Hide navbar if the current page is in the list (fallback to path check)
if (in_array($page, $hideNavbarPages, true) || str_contains($_SERVER['REQUEST_URI'], '/login')) {
$hideNavbar = true;
}
Sources: login.php:21-29
Pages with Hidden Navbar
The following pages are configured to hide the main navigation bar:
| Page/Route Name | Source File |
|---|---|
login | login.php:23 |
auth | login.php:24 |
/login (path) | apps/js/iite_components.js:42 |
/login.php (path) | apps/js/iite_components.js:43 |
Sources: login.php:21-29, apps/js/iite_components.js:40-44
Internationalization (i18n)
The system supports multiple languages. The user's language preference is passed via a lang GET parameter (e.g., /login.php?lang=fr), which is then stored in $_SESSION['lang']. On subsequent page loads, this session variable is used to retrieve the correct translated strings.
Sources: login.php:4-9, apps/pages.php, apps/translations.json