Spaces:
Runtime error
Runtime error
File size: 5,598 Bytes
88fe539 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
<!DOCTYPE html>
<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> |