Implemented token expiration tracking and user import
This commit is contained in:
parent
a0525e3007
commit
2f58aa563a
6
db.php
6
db.php
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
define("DB_HOST", "localhost");
|
||||
define("DB_USER", "ccah-user");
|
||||
define("DB_USER", "ccah_user");
|
||||
define("DB_PASS", "e_NQ,S^#sW6X:;nV!Uw.my");
|
||||
define("DB_NAME", "ccah_assessment");
|
||||
|
||||
|
|
@ -8,4 +8,8 @@ $conn = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
|
|||
if ($conn->connect_error) {
|
||||
die("Database connection failed: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
// Mark expired tokens
|
||||
$conn->query("UPDATE users SET expired = 1 WHERE expiry_date < NOW() AND expired = 0");
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ if (!$user) {
|
|||
exit;
|
||||
}
|
||||
// Check if token is expired
|
||||
if (strtotime($user['token_expires_at']) < time()) {
|
||||
if ($user['expired'] == 1) {
|
||||
http_response_code(403);
|
||||
echo json_encode(["error" => "Authentication token has expired."]);
|
||||
exit;
|
||||
|
|
|
|||
Loading…
Reference in New Issue