Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +9 -3
templates/index.html
CHANGED
|
@@ -126,7 +126,7 @@
|
|
| 126 |
}
|
| 127 |
|
| 128 |
function askLoginOrRegister() {
|
| 129 |
-
speak("Welcome to Biryani Hub
|
| 130 |
recognition.start();
|
| 131 |
recognition.onresult = function (event) {
|
| 132 |
let response = event.results[0][0].transcript.trim().toLowerCase();
|
|
@@ -262,7 +262,8 @@
|
|
| 262 |
});
|
| 263 |
}
|
| 264 |
|
| 265 |
-
|
|
|
|
| 266 |
speak("Please say your email for login.", function () {
|
| 267 |
recognition.start();
|
| 268 |
recognition.onresult = function (event) {
|
|
@@ -276,6 +277,7 @@
|
|
| 276 |
});
|
| 277 |
}
|
| 278 |
|
|
|
|
| 279 |
function confirmLoginEmail(emailCaptured) {
|
| 280 |
recognition.start();
|
| 281 |
recognition.onresult = function (event) {
|
|
@@ -289,6 +291,7 @@ function confirmLoginEmail(emailCaptured) {
|
|
| 289 |
};
|
| 290 |
}
|
| 291 |
|
|
|
|
| 292 |
function captureLoginMobile(emailCaptured) {
|
| 293 |
speak("Now, say your mobile number.", function () {
|
| 294 |
recognition.start();
|
|
@@ -303,6 +306,7 @@ function captureLoginMobile(emailCaptured) {
|
|
| 303 |
});
|
| 304 |
}
|
| 305 |
|
|
|
|
| 306 |
function confirmLoginMobile(emailCaptured, mobileCaptured) {
|
| 307 |
recognition.start();
|
| 308 |
recognition.onresult = function (event) {
|
|
@@ -316,6 +320,7 @@ function confirmLoginMobile(emailCaptured, mobileCaptured) {
|
|
| 316 |
};
|
| 317 |
}
|
| 318 |
|
|
|
|
| 319 |
function validateLoginWithSalesforce(emailCaptured, mobileCaptured) {
|
| 320 |
// Create an object with captured email and mobile number
|
| 321 |
const loginData = {
|
|
@@ -324,7 +329,7 @@ function validateLoginWithSalesforce(emailCaptured, mobileCaptured) {
|
|
| 324 |
};
|
| 325 |
|
| 326 |
// Make an API call to your backend (Flask/Node.js) that validates the login in Salesforce
|
| 327 |
-
fetch('/validate-login', {
|
| 328 |
method: 'POST',
|
| 329 |
headers: {
|
| 330 |
'Content-Type': 'application/json'
|
|
@@ -346,6 +351,7 @@ function validateLoginWithSalesforce(emailCaptured, mobileCaptured) {
|
|
| 346 |
}
|
| 347 |
|
| 348 |
|
|
|
|
| 349 |
window.onload = function () {
|
| 350 |
askLoginOrRegister();
|
| 351 |
};
|
|
|
|
| 126 |
}
|
| 127 |
|
| 128 |
function askLoginOrRegister() {
|
| 129 |
+
speak("Welcome to Biryani Hub Are you a new customer or an existing customer? Say 'new' to register or 'existing' to login.", function () {
|
| 130 |
recognition.start();
|
| 131 |
recognition.onresult = function (event) {
|
| 132 |
let response = event.results[0][0].transcript.trim().toLowerCase();
|
|
|
|
| 262 |
});
|
| 263 |
}
|
| 264 |
|
| 265 |
+
// Function to capture login details (email)
|
| 266 |
+
function captureLoginDetails() {
|
| 267 |
speak("Please say your email for login.", function () {
|
| 268 |
recognition.start();
|
| 269 |
recognition.onresult = function (event) {
|
|
|
|
| 277 |
});
|
| 278 |
}
|
| 279 |
|
| 280 |
+
// Function to confirm email
|
| 281 |
function confirmLoginEmail(emailCaptured) {
|
| 282 |
recognition.start();
|
| 283 |
recognition.onresult = function (event) {
|
|
|
|
| 291 |
};
|
| 292 |
}
|
| 293 |
|
| 294 |
+
// Function to capture mobile number
|
| 295 |
function captureLoginMobile(emailCaptured) {
|
| 296 |
speak("Now, say your mobile number.", function () {
|
| 297 |
recognition.start();
|
|
|
|
| 306 |
});
|
| 307 |
}
|
| 308 |
|
| 309 |
+
// Function to confirm mobile number
|
| 310 |
function confirmLoginMobile(emailCaptured, mobileCaptured) {
|
| 311 |
recognition.start();
|
| 312 |
recognition.onresult = function (event) {
|
|
|
|
| 320 |
};
|
| 321 |
}
|
| 322 |
|
| 323 |
+
// Function to validate login with Salesforce
|
| 324 |
function validateLoginWithSalesforce(emailCaptured, mobileCaptured) {
|
| 325 |
// Create an object with captured email and mobile number
|
| 326 |
const loginData = {
|
|
|
|
| 329 |
};
|
| 330 |
|
| 331 |
// Make an API call to your backend (Flask/Node.js) that validates the login in Salesforce
|
| 332 |
+
fetch('http://localhost:5000/validate-login', { // Change this URL if your backend runs on a different port
|
| 333 |
method: 'POST',
|
| 334 |
headers: {
|
| 335 |
'Content-Type': 'application/json'
|
|
|
|
| 351 |
}
|
| 352 |
|
| 353 |
|
| 354 |
+
|
| 355 |
window.onload = function () {
|
| 356 |
askLoginOrRegister();
|
| 357 |
};
|