Subbu1304 commited on
Commit
4ccc99e
·
verified ·
1 Parent(s): f91011b

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +6 -6
templates/index.html CHANGED
@@ -208,21 +208,21 @@
208
  };
209
  }
210
 
211
- function startListeningForMobileLogin() {
212
  recognition.start();
213
  recognition.onresult = function(event) {
214
- let mobileLogin = event.results[0][0].transcript.trim();
215
- document.getElementById('loginMobile').value = mobileLogin;
216
  recognition.stop();
217
- speak("You said " + mobileLogin + ". Is it correct?", function() {
218
  recognition.start();
219
  recognition.onresult = function(event) {
220
  let confirmation = event.results[0][0].transcript.trim().toLowerCase();
221
  recognition.stop();
222
  if (confirmation.includes("ok") || confirmation.includes("yes")) {
223
- speak("Login successful!");
224
  } else {
225
- speak("Let's try again. Please tell your mobile number.", startListeningForMobileLogin);
226
  }
227
  };
228
  });
 
208
  };
209
  }
210
 
211
+ function startListeningForMobile() {
212
  recognition.start();
213
  recognition.onresult = function(event) {
214
+ let mobileCaptured = event.results[0][0].transcript.trim().replace(/\s+/g, '');
215
+ document.getElementById('mobile').value = mobileCaptured;
216
  recognition.stop();
217
+ speak("You said " + mobileCaptured + ". Is it correct?", function() {
218
  recognition.start();
219
  recognition.onresult = function(event) {
220
  let confirmation = event.results[0][0].transcript.trim().toLowerCase();
221
  recognition.stop();
222
  if (confirmation.includes("ok") || confirmation.includes("yes")) {
223
+ speak("All details are captured. Confirming your registration.");
224
  } else {
225
+ speak("Let's try again. Tell me your mobile number.", startListeningForMobile);
226
  }
227
  };
228
  });