Verified Commit f3062dde authored by dockx thibault's avatar dockx thibault
Browse files

:sparkles: Feat(Login) - login adapt php8.2

Adapt include/login to php82
No related merge requests found
Showing with 7 additions and 7 deletions
+7 -7
......@@ -85,11 +85,11 @@ class LoginMethod
static function validateUserInput (): bool
{
global $message, $smarty;
static::$username = trim(static::$username);
static::$username = trim((string) static::$username);
if (!preg_match('/^[@A-Za-z0-9_.-]+$/', static::$username)) {
$message = _('Please specify a valid username!');
return FALSE;
} elseif (mb_strlen(static::$password, 'UTF-8') == 0) {
} elseif (mb_strlen((string) static::$password, 'UTF-8') == 0) {
$message = _('Please specify your password!');
$smarty->assign('focusfield', 'password');
return FALSE;
......@@ -170,7 +170,7 @@ class LoginMethod
}
/*! \brief Final step of successful login: redirect to main.php */
static function redirect ()
static function redirect (): never
{
static::connect();
header('Location: main.php');
......
......@@ -107,7 +107,7 @@ class LoginPost extends LoginMethod
/* Fill template with required values */
$username = '';
if (isset($_POST['username'])) {
$username = trim($_POST['username']);
$username = trim((string) $_POST['username']);
}
$smarty->assign('date', gmdate('D, d M Y H:i:s'));
$smarty->assign('username', $username);
......@@ -150,7 +150,7 @@ class LoginPost extends LoginMethod
/* show login screen */
$smarty->assign('PHPSESSID', session_id());
if ($error_collector != '') {
$smarty->assign('php_errors', preg_replace('/%BUGBODY%/', $error_collector_mailto, $error_collector).'</div>');
$smarty->assign('php_errors', preg_replace('/%BUGBODY%/', (string) $error_collector_mailto, (string) $error_collector).'</div>');
} else {
$smarty->assign('php_errors', '');
}
......@@ -179,7 +179,7 @@ class LoginPost extends LoginMethod
/* Fill template with required values */
$username = '';
if (isset($_POST['username'])) {
$username = trim($_POST['username']);
$username = trim((string) $_POST['username']);
}
$smarty->assign('date', gmdate('D, d M Y H:i:s'));
$smarty->assign('username', $username);
......@@ -196,7 +196,7 @@ class LoginPost extends LoginMethod
/* show login screen */
$smarty->assign('PHPSESSID', session_id());
if ($error_collector != '') {
$smarty->assign('php_errors', preg_replace('/%BUGBODY%/', $error_collector_mailto, $error_collector).'</div>');
$smarty->assign('php_errors', preg_replace('/%BUGBODY%/', (string) $error_collector_mailto, (string) $error_collector).'</div>');
} else {
$smarty->assign('php_errors', '');
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment