File size: 6,627 Bytes
9fb13a8 |
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 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sign Up - AI Coach</title>
<style>
body {
font-family: 'Roboto', Arial, sans-serif;
margin: 0;
padding: 0;
background: linear-gradient(135deg, #f0f2f5 0%, #e9ecef 100%);
color: #2d3748;
line-height: 1.6;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.signup-container {
background-color: #fff;
padding: 40px;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
width: 100%;
max-width: 400px;
text-align: center;
}
h2 {
color: #1a3c7a;
font-size: 28px;
font-weight: 700;
margin-bottom: 20px;
}
.input-group {
margin-bottom: 20px;
text-align: left;
}
label {
display: block;
font-size: 15px;
font-weight: 500;
color: #4a5568;
margin-bottom: 8px;
}
input, select {
width: 100%;
padding: 12px;
border: 2px solid #e2e8f0;
border-radius: 8px;
font-size: 15px;
box-sizing: border-box;
transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
input:focus, select:focus {
border-color: #ed8936;
outline: none;
box-shadow: 0 0 8px rgba(237, 137, 54, 0.3);
}
.checkbox-group {
display: flex;
align-items: center;
gap: 10px;
}
.checkbox-group input {
width: auto;
margin: 0;
}
button {
width: 100%;
padding: 12px;
background: linear-gradient(to right, #f6ad55, #ed8936);
color: #fff;
border: none;
border-radius: 8px;
cursor: pointer;
font-size: 16px;
font-weight: 600;
transition: transform 0.1s ease, background 0.3s ease;
}
button:hover {
background: linear-gradient(to right, #ed8936, #dd6b20);
transform: scale(1.02);
}
.login-link {
margin-top: 20px;
font-size: 14px;
color: #4a5568;
}
.login-link a {
color: #ed8936;
text-decoration: none;
font-weight: 500;
}
.login-link a:hover {
text-decoration: underline;
}
.error-message {
color: #f56565;
font-size: 14px;
margin-top: 10px;
display: none;
}
.error-message.visible {
display: block;
}
@media (max-width: 500px) {
.signup-container {
padding: 20px;
margin: 20px;
}
h2 {
font-size: 24px;
}
input, select, button {
font-size: 14px;
padding: 10px;
}
}
</style>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet">
</head>
<body>
<div class="signup-container">
<h2>AI Coach Sign Up</h2>
<div class="input-group">
<label for="username">Username</label>
<input type="text" id="username" placeholder="Enter your username">
</div>
<div class="input-group">
<label for="password">Password</label>
<input type="password" id="password" placeholder="Enter your password">
</div>
<div class="input-group">
<label for="project_id">Project ID</label>
<input type="text" id="project_id" placeholder="Enter your project ID (e.g., PROJ_001)">
</div>
<div class="input-group">
<label for="engagement_score">Engagement Score (%)</label>
<input type="number" id="engagement_score" min="0" max="100" placeholder="Enter engagement score (0-100)">
</div>
<div class="input-group checkbox-group">
<label for="kpi_flag">KPI Flag</label>
<input type="checkbox" id="kpi_flag">
</div>
<button onclick="signup()">Sign Up</button>
<p id="error-message" class="error-message"></p>
<p class="login-link">Already have an account? <a href="/login">Login here</a></p>
</div>
<script>
async function signup() {
const username = document.getElementById('username').value.trim();
const password = document.getElementById('password').value.trim();
const project_id = document.getElementById('project_id').value.trim();
const engagement_score = parseFloat(document.getElementById('engagement_score').value) || 85;
const kpi_flag = document.getElementById('kpi_flag').checked;
const errorMessage = document.getElementById('error-message');
if (!username || !password) {
errorMessage.textContent = 'Please enter both username and password.';
errorMessage.classList.add('visible');
return;
}
if (engagement_score < 0 || engagement_score > 100) {
errorMessage.textContent = 'Engagement score must be between 0 and 100.';
errorMessage.classList.add('visible');
return;
}
try {
const response = await fetch('/signup', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ username, password, project_id, engagement_score, kpi_flag })
});
const result = await response.json();
if (result.status === 'success') {
window.location.href = '/';
} else {
errorMessage.textContent = result.message || 'Signup failed. Please try again.';
errorMessage.classList.add('visible');
}
} catch (error) {
errorMessage.textContent = 'Error during signup: ' + error.message;
errorMessage.classList.add('visible');
}
}
</script>
</body>
</html> |