fix
This commit is contained in:
@@ -4,33 +4,3 @@ require_once __DIR__ . '/db.php';
|
|||||||
require_once __DIR__ . '/../app/UsersManager.class.php';
|
require_once __DIR__ . '/../app/UsersManager.class.php';
|
||||||
$userManager = new UserManager($db);
|
$userManager = new UserManager($db);
|
||||||
$currentUser = $userManager->checkAuth();
|
$currentUser = $userManager->checkAuth();
|
||||||
|
|
||||||
echo "<pre>";
|
|
||||||
|
|
||||||
if (!$currentUser) {
|
|
||||||
// Utente non autenticato
|
|
||||||
echo "Utente non autenticato\n";
|
|
||||||
// Controlla se esiste un username memorizzato (cookie scaduto)
|
|
||||||
$rememberedUsername = $userManager->getRememberedUsername();
|
|
||||||
|
|
||||||
if ($rememberedUsername) {
|
|
||||||
echo "Cookie scaduto ma username presente\n";
|
|
||||||
// Cookie scaduto ma username presente -> chiedi solo password
|
|
||||||
// header('Location: /reauth.php?username=' . urlencode($rememberedUsername));
|
|
||||||
exit;
|
|
||||||
} else {
|
|
||||||
// Nessuna autenticazione -> login completo
|
|
||||||
echo
|
|
||||||
// header('Location: /login.php');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Utente autenticato - memorizza in variabile globale per uso nelle pagine
|
|
||||||
// $_SESSION['user'] = $currentUser;
|
|
||||||
|
|
||||||
|
|
||||||
echo "</pre>";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
21
index.php
21
index.php
@@ -1,8 +1,29 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once __DIR__ . '/config/init.php';
|
require_once __DIR__ . '/config/init.php';
|
||||||
|
|
||||||
|
|
||||||
include 'parts/head.php';
|
include 'parts/head.php';
|
||||||
include 'parts/sidebar.php';
|
include 'parts/sidebar.php';
|
||||||
|
|
||||||
|
|
||||||
|
if (!$currentUser) {
|
||||||
|
// Utente non autenticato
|
||||||
|
|
||||||
|
// Controlla se esiste un username memorizzato (cookie scaduto)
|
||||||
|
$rememberedUsername = $userManager->getRememberedUsername();
|
||||||
|
|
||||||
|
if ($rememberedUsername) {
|
||||||
|
include 'login.php';
|
||||||
|
} else {
|
||||||
|
include 'login.php';
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Utente autenticato - memorizza in variabile globale per uso nelle pagine
|
||||||
|
$_SESSION['user'] = $currentUser;
|
||||||
|
|
||||||
|
|
||||||
include 'parts/content.php';
|
include 'parts/content.php';
|
||||||
include 'parts/footer.php';
|
include 'parts/footer.php';
|
||||||
?>
|
?>
|
||||||
58
login.php
Normal file
58
login.php
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
<!-- Outer Row -->
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
|
||||||
|
<div class="col-xl-10 col-lg-12 col-md-9">
|
||||||
|
|
||||||
|
<div class="card o-hidden border-0 shadow-lg my-5">
|
||||||
|
<div class="card-body p-0">
|
||||||
|
<!-- Nested Row within Card Body -->
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-6 d-none d-lg-block bg-login-image"></div>
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<div class="p-5">
|
||||||
|
<div class="text-center">
|
||||||
|
<h1 class="h4 text-gray-900 mb-4">Welcome Back!</h1>
|
||||||
|
</div>
|
||||||
|
<form class="user">
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="email" class="form-control form-control-user"
|
||||||
|
id="exampleInputEmail" aria-describedby="emailHelp"
|
||||||
|
placeholder="Enter Email Address...">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="password" class="form-control form-control-user"
|
||||||
|
id="exampleInputPassword" placeholder="Password">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="custom-control custom-checkbox small">
|
||||||
|
<input type="checkbox" class="custom-control-input" id="customCheck">
|
||||||
|
<label class="custom-control-label" for="customCheck">Remember
|
||||||
|
Me</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<a href="index.html" class="btn btn-primary btn-user btn-block">
|
||||||
|
Login
|
||||||
|
</a>
|
||||||
|
<hr>
|
||||||
|
<a href="index.html" class="btn btn-google btn-user btn-block">
|
||||||
|
<i class="fab fa-google fa-fw"></i> Login with Google
|
||||||
|
</a>
|
||||||
|
<a href="index.html" class="btn btn-facebook btn-user btn-block">
|
||||||
|
<i class="fab fa-facebook-f fa-fw"></i> Login with Facebook
|
||||||
|
</a>
|
||||||
|
</form>
|
||||||
|
<hr>
|
||||||
|
<div class="text-center">
|
||||||
|
<a class="small" href="forgot-password.html">Forgot Password?</a>
|
||||||
|
</div>
|
||||||
|
<div class="text-center">
|
||||||
|
<a class="small" href="register.html">Create an Account!</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
Reference in New Issue
Block a user