-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsignup.html
More file actions
143 lines (134 loc) · 5.53 KB
/
signup.html
File metadata and controls
143 lines (134 loc) · 5.53 KB
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
<script type="text/javascript">
var gk_isXlsx = false;
var gk_xlsxFileLookup = {};
var gk_fileData = {};
function filledCell(cell) {
return cell !== '' && cell != null;
}
function loadFileData(filename) {
if (gk_isXlsx && gk_xlsxFileLookup[filename]) {
try {
var workbook = XLSX.read(gk_fileData[filename], { type: 'base64' });
var firstSheetName = workbook.SheetNames[0];
var worksheet = workbook.Sheets[firstSheetName];
// Convert sheet to JSON to filter blank rows
var jsonData = XLSX.utils.sheet_to_json(worksheet, { header: 1, blankrows: false, defval: '' });
// Filter out blank rows (rows where all cells are empty, null, or undefined)
var filteredData = jsonData.filter(row => row.some(filledCell));
// Heuristic to find the header row by ignoring rows with fewer filled cells than the next row
var headerRowIndex = filteredData.findIndex((row, index) =>
row.filter(filledCell).length >= filteredData[index + 1]?.filter(filledCell).length
);
// Fallback
if (headerRowIndex === -1 || headerRowIndex > 25) {
headerRowIndex = 0;
}
// Convert filtered JSON back to CSV
var csv = XLSX.utils.aoa_to_sheet(filteredData.slice(headerRowIndex)); // Create a new sheet from filtered array of arrays
csv = XLSX.utils.sheet_to_csv(csv, { header: 1 });
return csv;
} catch (e) {
console.error(e);
return "";
}
}
return gk_fileData[filename] || "";
}
</script><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Mobile App Signup</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-gray-100 flex items-center justify-center min-h-screen">
<div class="bg-white p-6 rounded-lg shadow-lg w-full max-w-md">
<h2 class="text-2xl font-bold text-center text-gray-800 mb-6">Welcome to Our App!</h2>
<p id="personalized-message" class="text-center text-gray-600 mb-4">Let's get you started.</p>
<div id="error-message" class="hidden text-red-500 text-sm mb-4 text-center"></div>
<form id="signup-form" class="space-y-4">
<div>
<label for="name" class="block text-sm font-medium text-gray-700">Your Name</label>
<input
type="text"
id="name"
name="name"
class="mt-1 w-full p-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
placeholder="Enter your name"
required
/>
</div>
<div>
<label for="email" class="block text-sm font-medium text-gray-700">Email</label>
<input
type="email"
id="email"
name="email"
class="mt-1 w-full p-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
placeholder="Enter your email"
required
/>
</div>
<div>
<label for="password" class="block text-sm font-medium text-gray-700">Password</label>
<input
type="password"
id="password"
name="password"
class="mt-1 w-full p-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
placeholder="Create a password"
required
/>
</div>
<button
type="submit"
class="w-full bg-blue-600 text-white p-2 rounded-md hover:bg-blue-700 transition duration-200"
>
Sign Up
</button>
</form>
<p class="text-center text-sm text-gray-600 mt-4">
Your data is secure with us. We use encryption to protect your information.
</p>
</div>
<script>
const form = document.getElementById('signup-form');
const nameInput = document.getElementById('name');
const emailInput = document.getElementById('email');
const passwordInput = document.getElementById('password');
const errorMessage = document.getElementById('error-message');
const personalizedMessage = document.getElementById('personalized-message');
// Personalize the message when the user types their name
nameInput.addEventListener('input', () => {
const name = nameInput.value.trim();
personalizedMessage.textContent = name
? `Hi, ${name}! Let's get you started.`
: "Let's get you started.";
});
// Form submission and validation
form.addEventListener('submit', (e) => {
e.preventDefault();
errorMessage.classList.add('hidden');
let error = '';
// Basic validation
if (!nameInput.value.trim()) {
error = 'Please enter your name.';
} else if (!emailInput.value.includes('@') || !emailInput.value.includes('.')) {
error = 'Please enter a valid email.';
} else if (passwordInput.value.length < 6) {
error = 'Password must be at least 6 characters long.';
}
if (error) {
errorMessage.textContent = error;
errorMessage.classList.remove('hidden');
return;
}
// Simulate successful signup (replace with actual backend logic)
alert(`Welcome, ${nameInput.value}! Signup successful!`);
form.reset();
personalizedMessage.textContent = "Let's get you started.";
});
</script>
</body>
</html>