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 ...@@ -85,11 +85,11 @@ class LoginMethod
static function validateUserInput (): bool static function validateUserInput (): bool
{ {
global $message, $smarty; global $message, $smarty;
static::$username = trim(static::$username); static::$username = trim((string) static::$username);
if (!preg_match('/^[@A-Za-z0-9_.-]+$/', static::$username)) { if (!preg_match('/^[@A-Za-z0-9_.-]+$/', static::$username)) {
$message = _('Please specify a valid username!'); $message = _('Please specify a valid username!');
return FALSE; return FALSE;
} elseif (mb_strlen(static::$password, 'UTF-8') == 0) { } elseif (mb_strlen((string) static::$password, 'UTF-8') == 0) {
$message = _('Please specify your password!'); $message = _('Please specify your password!');
$smarty->assign('focusfield', 'password'); $smarty->assign('focusfield', 'password');
return FALSE; return FALSE;
...@@ -170,7 +170,7 @@ class LoginMethod ...@@ -170,7 +170,7 @@ class LoginMethod
} }
/*! \brief Final step of successful login: redirect to main.php */ /*! \brief Final step of successful login: redirect to main.php */
static function redirect () static function redirect (): never
{ {
static::connect(); static::connect();
header('Location: main.php'); header('Location: main.php');
......
...@@ -107,7 +107,7 @@ class LoginPost extends LoginMethod ...@@ -107,7 +107,7 @@ class LoginPost extends LoginMethod
/* Fill template with required values */ /* Fill template with required values */
$username = ''; $username = '';
if (isset($_POST['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('date', gmdate('D, d M Y H:i:s'));
$smarty->assign('username', $username); $smarty->assign('username', $username);
...@@ -150,7 +150,7 @@ class LoginPost extends LoginMethod ...@@ -150,7 +150,7 @@ class LoginPost extends LoginMethod
/* show login screen */ /* show login screen */
$smarty->assign('PHPSESSID', session_id()); $smarty->assign('PHPSESSID', session_id());
if ($error_collector != '') { 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 { } else {
$smarty->assign('php_errors', ''); $smarty->assign('php_errors', '');
} }
...@@ -179,7 +179,7 @@ class LoginPost extends LoginMethod ...@@ -179,7 +179,7 @@ class LoginPost extends LoginMethod
/* Fill template with required values */ /* Fill template with required values */
$username = ''; $username = '';
if (isset($_POST['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('date', gmdate('D, d M Y H:i:s'));
$smarty->assign('username', $username); $smarty->assign('username', $username);
...@@ -196,7 +196,7 @@ class LoginPost extends LoginMethod ...@@ -196,7 +196,7 @@ class LoginPost extends LoginMethod
/* show login screen */ /* show login screen */
$smarty->assign('PHPSESSID', session_id()); $smarty->assign('PHPSESSID', session_id());
if ($error_collector != '') { 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 { } else {
$smarty->assign('php_errors', ''); $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