You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Se non ci sono operazioni recenti, la sessione è scaduta -> resetta il token e permetti il login
169
+
// Resetta il token precedente per permettere il nuovo login
164
170
$database->update('zz_users', [
165
171
'session_token' => null,
166
172
], [
@@ -354,11 +360,11 @@ public function getFirstModule($first = null)
354
360
if (!$this->isAdmin()) {
355
361
$group = $this->getUser()['gruppo'];
356
362
357
-
$query .= ' AND `id` IN (SELECT `idmodule` FROM `zz_permissions` WHERE `idgruppo` = '.Group::where('nome', $group)->first()->id." AND `permessi` IN ('r', 'rw'))";
363
+
$query .= ' AND `id` IN (SELECT `idmodule` FROM `zz_permissions` WHERE `idgruppo` = ' . Group::where('nome', $group)->first()->id . " AND `permessi` IN ('r', 'rw'))";
358
364
}
359
365
360
366
$database = database();
361
-
$results = $database->fetchArray($query." AND `options` != '' AND `options` != 'menu' AND `options` IS NOT NULL ORDER BY `order` ASC", $parameters);
367
+
$results = $database->fetchArray($query . " AND `options` != '' AND `options` != 'menu' AND `options` IS NOT NULL ORDER BY `order` ASC", $parameters);
362
368
363
369
if (!empty($results)) {
364
370
$module = null;
@@ -488,7 +494,7 @@ public static function getBruteTimeout()
488
494
489
495
$database = database();
490
496
491
-
$results = $database->fetchArray('SELECT TIME_TO_SEC(TIMEDIFF(DATE_ADD(created_at, INTERVAL '.self::$brute_options['timeout'].' SECOND), NOW())) AS diff FROM zz_logs WHERE ip = :ip AND stato = :state AND DATE_ADD(created_at, INTERVAL :timeout SECOND) >= NOW() ORDER BY created_at DESC LIMIT 1', [
497
+
$results = $database->fetchArray('SELECT TIME_TO_SEC(TIMEDIFF(DATE_ADD(created_at, INTERVAL ' . self::$brute_options['timeout'] . ' SECOND), NOW())) AS diff FROM zz_logs WHERE ip = :ip AND stato = :state AND DATE_ADD(created_at, INTERVAL :timeout SECOND) >= NOW() ORDER BY created_at DESC LIMIT 1', [
492
498
':ip' => get_client_ip(),
493
499
':state' => self::getStatus()['failed']['code'],
494
500
':timeout' => self::$brute_options['timeout'],
@@ -603,7 +609,7 @@ public function attemptOTPLogin($token, $otp_code)
603
609
}
604
610
605
611
// Verifica token e OTP nel database
606
-
$token_record = $database->fetchOne('SELECT * FROM `zz_otp_tokens` WHERE `token` = '.prepare($token).' AND `enabled` = 1');
612
+
$token_record = $database->fetchOne('SELECT * FROM `zz_otp_tokens` WHERE `token` = ' . prepare($token) . ' AND `enabled` = 1');
607
613
608
614
if (empty($token_record)) {
609
615
return [
@@ -705,13 +711,13 @@ public function attemptOTPLogin($token, $otp_code)
705
711
}
706
712
707
713
// Pulisci l'OTP utilizzato
708
-
$database->query('UPDATE `zz_otp_tokens` SET `last_otp` = "" WHERE `id` = '.prepare($token_record['id']));
714
+
$database->query('UPDATE `zz_otp_tokens` SET `last_otp` = "" WHERE `id` = ' . prepare($token_record['id']));
@@ -965,7 +971,7 @@ public function identifyUser($user_id)
965
971
$database = database();
966
972
967
973
try {
968
-
$results = $database->fetchArray('SELECT `id`, `idanagrafica`, `username`, `session_token`, (SELECT `title` FROM `zz_groups` LEFT JOIN `zz_groups_lang` ON `zz_groups`.`id`=`zz_groups_lang`.`id_record` AND `zz_groups_lang`.`id_lang`='.prepare(Models\Locale::getDefault()->id).' WHERE `zz_groups`.`id` = `zz_users`.`idgruppo`) AS gruppo FROM `zz_users` WHERE `id` = :user_id AND `enabled` = 1 LIMIT 1', [
974
+
$results = $database->fetchArray('SELECT `id`, `idanagrafica`, `username`, `session_token`, (SELECT `title` FROM `zz_groups` LEFT JOIN `zz_groups_lang` ON `zz_groups`.`id`=`zz_groups_lang`.`id_record` AND `zz_groups_lang`.`id_lang`=' . prepare(Models\Locale::getDefault()->id) . ' WHERE `zz_groups`.`id` = `zz_users`.`idgruppo`) AS gruppo FROM `zz_users` WHERE `id` = :user_id AND `enabled` = 1 LIMIT 1', [
969
975
':user_id' => $user_id,
970
976
]);
971
977
@@ -1034,7 +1040,7 @@ protected function saveToSession()
(1, (SELECTMAX(`id`) FROM`zz_settings`), 'Abilita controllo sessione singola', 'Se abilitato, impedisce il login multiplo dello stesso utente da dispositivi diversi.'),
7
+
(2, (SELECTMAX(`id`) FROM`zz_settings`), 'Enable single session control', 'If enabled, prevents multiple logins of the same user from different devices.');
0 commit comments