Spaces:
Sleeping
Sleeping
Upload login.html
Browse files- login.html +78 -0
login.html
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!doctype html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
<title>Login — StartupAI</title>
|
| 8 |
+
|
| 9 |
+
<link rel="stylesheet" href="style.css" />
|
| 10 |
+
|
| 11 |
+
<!-- Firebase -->
|
| 12 |
+
<script src="https://www.gstatic.com/firebasejs/8.10.0/firebase-app.js"></script>
|
| 13 |
+
<script src="https://www.gstatic.com/firebasejs/8.10.0/firebase-app.js"></script>
|
| 14 |
+
<script src="script.js"></script>
|
| 15 |
+
|
| 16 |
+
</head>
|
| 17 |
+
|
| 18 |
+
<body>
|
| 19 |
+
|
| 20 |
+
<!-- ===================== LOGIN CONTAINER ===================== -->
|
| 21 |
+
<main style="min-height:100vh;display:flex;align-items:center;justify-content:center;">
|
| 22 |
+
<div class="modal-card" style="max-width:420px;text-align:center;">
|
| 23 |
+
<h2 style="margin-bottom:10px;">Welcome to <span style="color:#7f3bf0">StartupAI</span></h2>
|
| 24 |
+
<p class="muted" style="margin-bottom:24px;">
|
| 25 |
+
Login using Google to continue exploring AI-powered startup analysis.
|
| 26 |
+
</p>
|
| 27 |
+
|
| 28 |
+
<button id="googleLoginBtn" class="btn primary" style="width:100%;padding:14px;">
|
| 29 |
+
Continue with Google
|
| 30 |
+
</button>
|
| 31 |
+
|
| 32 |
+
<p class="muted small" style="margin-top:16px;">
|
| 33 |
+
We do not post anything on your behalf.
|
| 34 |
+
</p>
|
| 35 |
+
|
| 36 |
+
<div id="loginStatus" class="muted small" style="margin-top:10px;"></div>
|
| 37 |
+
</div>
|
| 38 |
+
</main>
|
| 39 |
+
|
| 40 |
+
<!-- ===================== SCRIPT ===================== -->
|
| 41 |
+
<script>
|
| 42 |
+
/* Firebase Config */
|
| 43 |
+
const firebaseConfig = {
|
| 44 |
+
apiKey: "AIzaSyDVwJCmDIEV4cIPDEEzxCLOnDF1f3m3YbA",
|
| 45 |
+
authDomain: "success-predictor-fire.firebaseapp.com",
|
| 46 |
+
projectId: "success-predictor-fire",
|
| 47 |
+
};
|
| 48 |
+
firebase.initializeApp(firebaseConfig);
|
| 49 |
+
const auth = firebase.auth();
|
| 50 |
+
|
| 51 |
+
/* Login Handler */
|
| 52 |
+
document.getElementById("googleLoginBtn").onclick = async () => {
|
| 53 |
+
try {
|
| 54 |
+
document.getElementById("loginStatus").innerText = "Signing in...";
|
| 55 |
+
|
| 56 |
+
const provider = new firebase.auth.GoogleAuthProvider();
|
| 57 |
+
const result = await auth.signInWithPopup(provider);
|
| 58 |
+
const token = await result.user.getIdToken();
|
| 59 |
+
|
| 60 |
+
await fetch("/api/login", {
|
| 61 |
+
method: "POST",
|
| 62 |
+
headers: { "Content-Type": "application/json" },
|
| 63 |
+
body: JSON.stringify({ token }),
|
| 64 |
+
});
|
| 65 |
+
|
| 66 |
+
document.getElementById("loginStatus").innerText = "Login successful! Redirecting...";
|
| 67 |
+
setTimeout(() => location.href = "/", 1200);
|
| 68 |
+
|
| 69 |
+
} catch (err) {
|
| 70 |
+
document.getElementById("loginStatus").innerText = "Login failed. Try again.";
|
| 71 |
+
console.error(err);
|
| 72 |
+
}
|
| 73 |
+
};
|
| 74 |
+
</script>
|
| 75 |
+
|
| 76 |
+
</body>
|
| 77 |
+
|
| 78 |
+
</html>
|