. */ use App\Models\User; use Illuminate\Support\Facades\Hash; $skip_permissions = true; include_once __DIR__.'/core.php'; $op = filter('op'); // LOGIN switch ($op) { case 'login': $username = post('username'); $password = post('password'); $user = User::where('username', $username)->first(); if (!empty($user) && Hash::check($password, $user->getAuthPassword())) { auth()->loginUsingId($user->id, true); // Rimozione log vecchi //$dbo->query('DELETE FROM `zz_operations` WHERE DATE_ADD(`created_at`, INTERVAL 30*24*60*60 SECOND) <= NOW()'); } else { $status = auth()->user(); //flash()->error(auth()->getStatus()[$status]['message']); redirect('/'); } break; case 'logout': auth()->logout(); redirect(route('login')); break; } if (auth()->check() && isset($dbo) && $dbo->isConnected() && $dbo->isInstalled()) { $module = 1; if (!empty($module)) { redirect_legacy(base_url().'/controller.php?id_module='.$module); } else { redirect_legacy(base_url().'/index.php?op=logout'); } throw new \LegacyExitException(); } // Procedura di installazione include_once base_dir().'/include/init/configuration.php'; // Procedura di aggiornamento include_once base_dir().'/include/init/update.php'; // Procedura di inizializzazione include_once base_dir().'/include/init/init.php'; $pageTitle = tr('Login'); include_once AppLegacy::filepath('include|custom|', 'top.php'); // Controllo se è una beta e in caso mostro un warning if (Update::isBeta()) { echo '
'.tr('Sono stati effettuati troppi tentativi di accesso consecutivi!').'
'.tr('Tempo rimanente (in secondi)').': '.(auth()->getBruteTimeout() + 1).'