mirror of
https://github.com/myronblair/jarvis
synced 2026-06-30 17:50:23 -05:00
fix: pure PHP login — login.php POSTs to PHP, bridge.php writes token to sessionStorage, zero JS dependency for auth
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
// Reads the PHP session token set by login.php and hands it to the browser's
|
||||
// sessionStorage, then redirects to the main app (index.html).
|
||||
session_name('jarvis_main');
|
||||
session_start();
|
||||
|
||||
$token = $_SESSION['jarvis_token'] ?? '';
|
||||
$name = $_SESSION['jarvis_name'] ?? '';
|
||||
|
||||
if (!$token) {
|
||||
header('Location: /login.php');
|
||||
exit;
|
||||
}
|
||||
?><!DOCTYPE html>
|
||||
<html><head><meta charset="UTF-8"/>
|
||||
<title>JARVIS</title>
|
||||
<style>body{background:#000810;margin:0}</style>
|
||||
</head><body>
|
||||
<script>
|
||||
sessionStorage.setItem('jarvis_token', <?= json_encode($token) ?>);
|
||||
sessionStorage.setItem('jarvis_user', <?= json_encode($name) ?>);
|
||||
window.location.replace('/');
|
||||
</script>
|
||||
</body></html>
|
||||
Reference in New Issue
Block a user