updated login
45
public/api/login.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
// login.php
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
// Enable CORS
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header('Access-Control-Allow-Methods: POST, OPTIONS');
|
||||
header('Access-Control-Allow-Headers: Content-Type');
|
||||
|
||||
// Handle preflight requests
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
|
||||
http_response_code(204);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Simulated database of users
|
||||
$users = [
|
||||
'user1@example.com' => 'password123',
|
||||
'user2@example.com' => 'securepassword',
|
||||
];
|
||||
|
||||
// Read input data
|
||||
$input = json_decode(file_get_contents('php://input'), true);
|
||||
$email = $input['email'] ?? '';
|
||||
$password = $input['password'] ?? '';
|
||||
|
||||
// Validate input
|
||||
if (empty($email) || empty($password)) {
|
||||
http_response_code(400);
|
||||
echo json_encode(['error' => 'Email and password are required.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Authenticate user
|
||||
if (isset($users[$email]) && $users[$email] === $password) {
|
||||
// Generate a token (for simplicity, using base64 encoding)
|
||||
$token = base64_encode($email . ':' . time());
|
||||
|
||||
echo json_encode(['token' => $token]);
|
||||
} else {
|
||||
http_response_code(401);
|
||||
echo json_encode(['error' => 'Invalid email or password.']);
|
||||
}
|
||||
?>
|
||||
|
Before Width: | Height: | Size: 2.3 KiB |
BIN
public/favicon/apple-touch-icon.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
public/favicon/favicon-96x96.png
Normal file
|
After Width: | Height: | Size: 6.3 KiB |
BIN
public/favicon/favicon.ico
Normal file
|
After Width: | Height: | Size: 15 KiB |
3
public/favicon/favicon.svg
Normal file
|
After Width: | Height: | Size: 146 KiB |
21
public/favicon/site.webmanifest
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "MyWebSite",
|
||||
"short_name": "MySite",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/web-app-manifest-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable"
|
||||
},
|
||||
{
|
||||
"src": "/web-app-manifest-512x512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable"
|
||||
}
|
||||
],
|
||||
"theme_color": "#ffffff",
|
||||
"background_color": "#ffffff",
|
||||
"display": "standalone"
|
||||
}
|
||||
BIN
public/favicon/web-app-manifest-192x192.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
public/favicon/web-app-manifest-512x512.png
Normal file
|
After Width: | Height: | Size: 102 KiB |
BIN
public/images/logo.webp
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
public/images/logo_dark.webp
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
public/images/logo_icon.webp
Normal file
|
After Width: | Height: | Size: 5.8 KiB |