Subbu1304 commited on
Commit
a53cbe2
·
verified ·
1 Parent(s): 426a870

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +56 -43
templates/index.html CHANGED
@@ -365,49 +365,20 @@ function speak(message, callback) {
365
  };
366
  }
367
 
368
- // function submitLogin() {
369
- // const loginEmail = document.getElementById('loginEmail').value;
370
- // const loginMobile = document.getElementById('loginMobile').value;
371
-
372
- // // Simulate login check
373
- // if (loginEmail && loginMobile) {
374
- // window.location.href = '/menu'; // Redirect to menu after successful login
375
- // } else {
376
- // alert("Invalid login details. Please try again.");
377
- // }
378
- // }
379
- // function submitLogin() {
380
- // const loginEmail = document.getElementById('loginEmail').value;
381
- // const loginMobile = document.getElementById('loginMobile').value;
382
 
383
- // // Simulate login check by querying Salesforce
384
- // if (loginEmail && loginMobile) {
385
- // fetch('/validate-login', {
386
- // method: 'POST',
387
- // headers: { 'Content-Type': 'application/json' },
388
- // body: JSON.stringify({ email: loginEmail, mobile: loginMobile })
389
- // })
390
- // .then(response => response.json())
391
- // .then(data => {
392
- // if (data.success) {
393
- // const userName = data.name; // Retrieve the name from the response
394
- // speak(`Welcome, ${userName}!`); // Speak the welcome message with the user's name
395
- // window.location.href = '/menu'; // Redirect to menu after successful login
396
- // } else {
397
- // // alert("Invalid login details. Please try again.");
398
- // speak("Invalid login details. Please try again.");
399
- // }
400
- // })
401
- // .catch(error => {
402
- // console.error('Login validation failed:', error);
403
- // alert("An error occurred. Please try again.");
404
- // });
405
- // } else {
406
- // alert("Please provide both email and mobile number.");
407
- // }
408
- // }function submitLogin() {
409
- const loginEmail = document.getElementById('loginEmail').value;
410
- const loginMobile = document.getElementById('loginMobile').value;
411
 
412
  // Simulate login check by querying Salesforce
413
  if (loginEmail && loginMobile) {
@@ -423,6 +394,9 @@ function speak(message, callback) {
423
  speak(`Welcome, ${userName}!`); // Speak the welcome message with the user's name
424
  window.location.href = '/menu'; // Redirect to menu after successful login
425
  } else {
 
 
 
426
  // Check if the login details are wrong and provide feedback based on the wrong field
427
  if (!isValidEmail(loginEmail)) {
428
  speak("Invalid email address. Please try again and say your email.");
@@ -433,6 +407,7 @@ function speak(message, callback) {
433
  } else {
434
  speak("Invalid login details. Please try again.");
435
  }
 
436
  }
437
  })
438
  .catch(error => {
@@ -442,7 +417,45 @@ function speak(message, callback) {
442
  } else {
443
  alert("Please provide both email and mobile number.");
444
  }
445
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
446
 
447
 
448
  window.onload = function () {
 
365
  };
366
  }
367
 
368
+ function submitLogin() {
369
+ const loginEmail = document.getElementById('loginEmail').value;
370
+ const loginMobile = document.getElementById('loginMobile').value;
 
 
 
 
 
 
 
 
 
 
 
371
 
372
+ // Simulate login check
373
+ if (loginEmail && loginMobile) {
374
+ window.location.href = '/menu'; // Redirect to menu after successful login
375
+ } else {
376
+ alert("Invalid login details. Please try again.");
377
+ }
378
+ }
379
+ function submitLogin() {
380
+ const loginEmail = document.getElementById('loginEmail').value;
381
+ const loginMobile = document.getElementById('loginMobile').value;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
382
 
383
  // Simulate login check by querying Salesforce
384
  if (loginEmail && loginMobile) {
 
394
  speak(`Welcome, ${userName}!`); // Speak the welcome message with the user's name
395
  window.location.href = '/menu'; // Redirect to menu after successful login
396
  } else {
397
+ // alert("Invalid login details. Please try again.");
398
+ // speak("Invalid login details. Please try again.");
399
+
400
  // Check if the login details are wrong and provide feedback based on the wrong field
401
  if (!isValidEmail(loginEmail)) {
402
  speak("Invalid email address. Please try again and say your email.");
 
407
  } else {
408
  speak("Invalid login details. Please try again.");
409
  }
410
+
411
  }
412
  })
413
  .catch(error => {
 
417
  } else {
418
  alert("Please provide both email and mobile number.");
419
  }
420
+
421
+ // }function submitLogin() {
422
+ // const loginEmail = document.getElementById('loginEmail').value;
423
+ // const loginMobile = document.getElementById('loginMobile').value;
424
+
425
+ // // Simulate login check by querying Salesforce
426
+ // if (loginEmail && loginMobile) {
427
+ // fetch('/validate-login', {
428
+ // method: 'POST',
429
+ // headers: { 'Content-Type': 'application/json' },
430
+ // body: JSON.stringify({ email: loginEmail, mobile: loginMobile })
431
+ // })
432
+ // .then(response => response.json())
433
+ // .then(data => {
434
+ // if (data.success) {
435
+ // const userName = data.name; // Retrieve the name from the response
436
+ // speak(`Welcome, ${userName}!`); // Speak the welcome message with the user's name
437
+ // window.location.href = '/menu'; // Redirect to menu after successful login
438
+ // } else {
439
+ // // Check if the login details are wrong and provide feedback based on the wrong field
440
+ // if (!isValidEmail(loginEmail)) {
441
+ // speak("Invalid email address. Please try again and say your email.");
442
+ // startEmailRecognition();
443
+ // } else if (!isValidMobile(loginMobile)) {
444
+ // speak("Invalid mobile number. Please try again and say your mobile number.");
445
+ // startMobileNumberRecognition();
446
+ // } else {
447
+ // speak("Invalid login details. Please try again.");
448
+ // }
449
+ // }
450
+ // })
451
+ // .catch(error => {
452
+ // console.error('Login validation failed:', error);
453
+ // alert("An error occurred. Please try again.");
454
+ // });
455
+ // } else {
456
+ // alert("Please provide both email and mobile number.");
457
+ // }
458
+ // }
459
 
460
 
461
  window.onload = function () {