Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +1 -67
templates/index.html
CHANGED
@@ -108,7 +108,7 @@
|
|
108 |
<body>
|
109 |
<div class="container">
|
110 |
<!-- Register Section -->
|
111 |
-
<div class="form-container" id="registrationForm"
|
112 |
<h1>Welcome to Biryani Hub 🍽 🍗</h1>
|
113 |
<div class="form-section">
|
114 |
<h2 class="header">Register</h2>
|
@@ -308,72 +308,6 @@
|
|
308 |
});
|
309 |
}
|
310 |
|
311 |
-
// Start login process
|
312 |
-
function startListeningForLoginEmail() {
|
313 |
-
recognition.start();
|
314 |
-
recognition.onresult = function(event) {
|
315 |
-
emailCaptured = event.results[0][0].transcript.trim().replace(/\bat\b/g, '@').replace(/\s+/g, '');
|
316 |
-
document.getElementById('loginEmail').value = emailCaptured;
|
317 |
-
recognition.stop();
|
318 |
-
speak("You said " + emailCaptured + ". Is it correct?", confirmLoginEmail);
|
319 |
-
};
|
320 |
-
}
|
321 |
-
|
322 |
-
function confirmLoginEmail() {
|
323 |
-
recognition.start();
|
324 |
-
recognition.onresult = function(event) {
|
325 |
-
let confirmation = event.results[0][0].transcript.trim().toLowerCase();
|
326 |
-
recognition.stop();
|
327 |
-
if (confirmation.includes("ok")) {
|
328 |
-
speak("Great! Now, tell me your mobile number.", startListeningForLoginMobile);
|
329 |
-
} else {
|
330 |
-
speak("Let's try again. Tell me your email.", startListeningForLoginEmail);
|
331 |
-
}
|
332 |
-
};
|
333 |
-
}
|
334 |
-
|
335 |
-
function startListeningForLoginMobile() {
|
336 |
-
recognition.start();
|
337 |
-
recognition.onresult = function(event) {
|
338 |
-
mobileCaptured = event.results[0][0].transcript.trim().replace(/\s+/g, '');
|
339 |
-
document.getElementById('loginMobile').value = mobileCaptured;
|
340 |
-
recognition.stop();
|
341 |
-
speak("You said " + mobileCaptured + ". Is it correct?", confirmLoginMobile);
|
342 |
-
};
|
343 |
-
}
|
344 |
-
|
345 |
-
function confirmLoginMobile() {
|
346 |
-
recognition.start();
|
347 |
-
recognition.onresult = function(event) {
|
348 |
-
let confirmation = event.results[0][0].transcript.trim().toLowerCase();
|
349 |
-
recognition.stop();
|
350 |
-
if (confirmation.includes("ok")) {
|
351 |
-
submitLogin();
|
352 |
-
} else {
|
353 |
-
speak("Let's try again. Tell me your mobile number.", startListeningForLoginMobile);
|
354 |
-
}
|
355 |
-
};
|
356 |
-
}
|
357 |
-
|
358 |
-
// Submit login details to backend
|
359 |
-
function submitLogin() {
|
360 |
-
let email = document.getElementById('loginEmail').value;
|
361 |
-
let mobile = document.getElementById('loginMobile').value;
|
362 |
-
fetch('/submit_login', {
|
363 |
-
method: 'POST',
|
364 |
-
headers: { 'Content-Type': 'application/json' },
|
365 |
-
body: JSON.stringify({ email: email, mobile: mobile })
|
366 |
-
})
|
367 |
-
.then(response => response.json())
|
368 |
-
.then(data => {
|
369 |
-
speak("Login successful. Welcome back!");
|
370 |
-
// Redirect or perform other actions
|
371 |
-
})
|
372 |
-
.catch(error => {
|
373 |
-
speak("There was an error with your login. Please try again.");
|
374 |
-
});
|
375 |
-
}
|
376 |
-
|
377 |
window.onload = function () {
|
378 |
askLoginOrRegister();
|
379 |
};
|
|
|
108 |
<body>
|
109 |
<div class="container">
|
110 |
<!-- Register Section -->
|
111 |
+
<div class="form-container" id="registrationForm">
|
112 |
<h1>Welcome to Biryani Hub 🍽 🍗</h1>
|
113 |
<div class="form-section">
|
114 |
<h2 class="header">Register</h2>
|
|
|
308 |
});
|
309 |
}
|
310 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
311 |
window.onload = function () {
|
312 |
askLoginOrRegister();
|
313 |
};
|