Spaces:
Runtime error
Runtime error
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>ThutoAI - Student Login</title> | |
| <style> | |
| * { | |
| margin: 0; | |
| padding: 0; | |
| box-sizing: border-box; | |
| } | |
| body { | |
| font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; | |
| background: linear-gradient(135deg, #1877f2 0%, #42a5f5 100%); | |
| height: 100vh; | |
| display: flex; | |
| justify-content: center; | |
| align-items: center; | |
| } | |
| .login-container { | |
| background: white; | |
| padding: 40px; | |
| border-radius: 15px; | |
| box-shadow: 0 8px 32px rgba(24, 119, 242, 0.3); | |
| width: 90%; | |
| max-width: 400px; | |
| text-align: center; | |
| } | |
| .logo { | |
| font-size: 32px; | |
| font-weight: bold; | |
| color: #1877f2; | |
| margin-bottom: 10px; | |
| } | |
| .subtitle { | |
| color: #65676b; | |
| margin-bottom: 30px; | |
| } | |
| .form-group { | |
| margin-bottom: 20px; | |
| text-align: left; | |
| } | |
| .form-group label { | |
| display: block; | |
| margin-bottom: 5px; | |
| color: #1c1e21; | |
| font-weight: 500; | |
| } | |
| .form-group input { | |
| width: 100%; | |
| padding: 14px 16px; | |
| border: 1px solid #dddfe2; | |
| border-radius: 6px; | |
| font-size: 16px; | |
| transition: border-color 0.3s; | |
| background: #f5f6f7; | |
| } | |
| .form-group input:focus { | |
| outline: none; | |
| border-color: #1877f2; | |
| background: white; | |
| } | |
| .login-btn { | |
| width: 100%; | |
| padding: 12px; | |
| background: #1877f2; | |
| color: white; | |
| border: none; | |
| border-radius: 6px; | |
| font-size: 16px; | |
| font-weight: 600; | |
| cursor: pointer; | |
| transition: background 0.3s; | |
| } | |
| .login-btn:hover { | |
| background: #166fe5; | |
| } | |
| .login-btn:disabled { | |
| opacity: 0.7; | |
| cursor: not-allowed; | |
| } | |
| .error-message { | |
| color: #e41e3f; | |
| margin-top: 15px; | |
| padding: 10px; | |
| background: #ffebee; | |
| border-radius: 5px; | |
| display: none; | |
| } | |
| .demo-info { | |
| margin-top: 30px; | |
| padding: 20px; | |
| background: #e7f3ff; | |
| border-radius: 8px; | |
| border-left: 4px solid #1877f2; | |
| } | |
| .demo-info h4 { | |
| color: #1877f2; | |
| margin-bottom: 10px; | |
| } | |
| .demo-info p { | |
| color: #65676b; | |
| font-size: 14px; | |
| margin-bottom: 5px; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="login-container"> | |
| <div class="logo">ThutoAI</div> | |
| <div class="subtitle">Your AI-Powered Student Portal</div> | |
| <form id="loginForm"> | |
| <div class="form-group"> | |
| <label for="username">Student ID</label> | |
| <input type="text" id="username" name="username" required> | |
| </div> | |
| <div class="form-group"> | |
| <label for="password">Password</label> | |
| <input type="password" id="password" name="password" required> | |
| </div> | |
| <button type="submit" class="login-btn" id="loginBtn"> | |
| Sign In | |
| </button> | |
| <div class="error-message" id="errorMessage"></div> | |
| </form> | |
| <div class="demo-info"> | |
| <h4>Demo Credentials</h4> | |
| <p><strong>Username:</strong> student123</p> | |
| <p><strong>Password:</strong> password123</p> | |
| <p><em>Use these credentials to explore ThutoAI</em></p> | |
| </div> | |
| </div> | |
| <script> | |
| document.getElementById('loginForm').addEventListener('submit', async (e) => { | |
| e.preventDefault(); | |
| const username = document.getElementById('username').value; | |
| const password = document.getElementById('password').value; | |
| const loginBtn = document.getElementById('loginBtn'); | |
| const errorMessage = document.getElementById('errorMessage'); | |
| loginBtn.disabled = true; | |
| loginBtn.textContent = 'Signing In...'; | |
| errorMessage.style.display = 'none'; | |
| try { | |
| const response = await fetch('/login', { | |
| method: 'POST', | |
| headers: { | |
| 'Content-Type': 'application/json', | |
| }, | |
| body: JSON.stringify({ username, password }) | |
| }); | |
| const data = await response.json(); | |
| if (data.success) { | |
| window.location.href = data.redirect; | |
| } else { | |
| errorMessage.textContent = data.message; | |
| errorMessage.style.display = 'block'; | |
| } | |
| } catch (error) { | |
| errorMessage.textContent = 'Login failed. Please try again.'; | |
| errorMessage.style.display = 'block'; | |
| } finally { | |
| loginBtn.disabled = false; | |
| loginBtn.textContent = 'Sign In'; | |
| } | |
| }); | |
| </script> | |
| </body> | |
| </html> |