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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
<!DOCTYPE html>
|
| 3 |
+
<html lang="en">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="UTF-8">
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
+
<title>Biryani Hub - Register & Login</title>
|
| 8 |
+
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap" rel="stylesheet">
|
| 9 |
+
<style>
|
| 10 |
+
body {
|
| 11 |
+
font-family: 'Roboto', sans-serif;
|
| 12 |
+
background: linear-gradient(135deg, #f4c542, #ff8f6a);
|
| 13 |
+
margin: 0;
|
| 14 |
+
display: flex;
|
| 15 |
+
flex-direction: column;
|
| 16 |
+
justify-content: center;
|
| 17 |
+
align-items: center;
|
| 18 |
+
height: 100vh;
|
| 19 |
+
text-align: center;
|
| 20 |
+
}
|
| 21 |
+
.header-title {
|
| 22 |
+
font-size: 40px;
|
| 23 |
+
font-weight: bold;
|
| 24 |
+
color: white;
|
| 25 |
+
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
|
| 26 |
+
margin-bottom: 20px;
|
| 27 |
+
}
|
| 28 |
+
.container {
|
| 29 |
+
background-color: #fff;
|
| 30 |
+
padding: 40px 50px;
|
| 31 |
+
border-radius: 10px;
|
| 32 |
+
width: 500px;
|
| 33 |
+
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
|
| 34 |
+
display: none;
|
| 35 |
+
}
|
| 36 |
+
.form-container {
|
| 37 |
+
width: 100%;
|
| 38 |
+
}
|
| 39 |
+
h2 {
|
| 40 |
+
font-size: 24px;
|
| 41 |
+
font-weight: bold;
|
| 42 |
+
color: #ff6a00;
|
| 43 |
+
margin-bottom: 20px;
|
| 44 |
+
}
|
| 45 |
+
label {
|
| 46 |
+
font-size: 16px;
|
| 47 |
+
display: block;
|
| 48 |
+
text-align: left;
|
| 49 |
+
font-weight: bold;
|
| 50 |
+
color: #333;
|
| 51 |
+
margin-top: 10px;
|
| 52 |
+
}
|
| 53 |
+
input {
|
| 54 |
+
width: 100%;
|
| 55 |
+
padding: 12px;
|
| 56 |
+
font-size: 16px;
|
| 57 |
+
border: 2px solid #ccc;
|
| 58 |
+
border-radius: 8px;
|
| 59 |
+
margin-top: 8px;
|
| 60 |
+
box-sizing: border-box;
|
| 61 |
+
background-color: #f9f9f9;
|
| 62 |
+
}
|
| 63 |
+
input:focus {
|
| 64 |
+
border-color: #ff6a00;
|
| 65 |
+
outline: none;
|
| 66 |
+
}
|
| 67 |
+
.info {
|
| 68 |
+
margin-top: 20px;
|
| 69 |
+
font-size: 16px;
|
| 70 |
+
color: #ff6a00;
|
| 71 |
+
font-weight: bold;
|
| 72 |
+
}
|
| 73 |
+
.status {
|
| 74 |
+
font-size: 14px;
|
| 75 |
+
color: gray;
|
| 76 |
+
margin-top: 10px;
|
| 77 |
+
}
|
| 78 |
+
#confirmation {
|
| 79 |
+
display: none;
|
| 80 |
+
background-color: #f9f9f9;
|
| 81 |
+
padding: 20px;
|
| 82 |
+
border-radius: 10px;
|
| 83 |
+
margin-top: 20px;
|
| 84 |
+
}
|
| 85 |
+
.confirm-button {
|
| 86 |
+
padding: 10px 20px;
|
| 87 |
+
background-color: #ff6a00;
|
| 88 |
+
color: white;
|
| 89 |
+
border: none;
|
| 90 |
+
border-radius: 5px;
|
| 91 |
+
cursor: pointer;
|
| 92 |
+
}
|
| 93 |
+
.confirm-button:hover {
|
| 94 |
+
background-color: #e65e00;
|
| 95 |
+
}
|
| 96 |
+
</style>
|
| 97 |
+
</head>
|
| 98 |
+
<body>
|
| 99 |
+
<h1 class="header-title">Welcome to Biryani Hub 🍽</h1>
|
| 100 |
+
|
| 101 |
+
<div class="container" id="registrationForm">
|
| 102 |
+
<div class="form-container">
|
| 103 |
+
<h2>Register</h2>
|
| 104 |
+
<label for="name">Your Name</label>
|
| 105 |
+
<input type="text" id="name" placeholder="Your name will appear here..." readonly>
|
| 106 |
+
|
| 107 |
+
<label for="email">Your Email</label>
|
| 108 |
+
<input type="text" id="email" placeholder="Your email will appear here..." readonly>
|
| 109 |
+
|
| 110 |
+
<label for="mobile">Your Mobile Number</label>
|
| 111 |
+
<input type="text" id="mobile" placeholder="Your mobile number will appear here..." readonly>
|
| 112 |
+
|
| 113 |
+
<p class="info" id="infoMessage">Listening 🗣🎙️...</p>
|
| 114 |
+
</div>
|
| 115 |
+
</div>
|
| 116 |
+
|
| 117 |
+
<div class="container" id="loginForm">
|
| 118 |
+
<div class="form-container">
|
| 119 |
+
<h2>Login</h2>
|
| 120 |
+
<label for="loginEmail">Your Email</label>
|
| 121 |
+
<input type="text" id="loginEmail" placeholder="Your email will appear here..." readonly>
|
| 122 |
+
|
| 123 |
+
<label for="loginMobile">Your Mobile Number</label>
|
| 124 |
+
<input type="text" id="loginMobile" placeholder="Your mobile number will appear here..." readonly>
|
| 125 |
+
|
| 126 |
+
<p class="info" id="infoMessageLogin">Listening 🗣🎙️...</p>
|
| 127 |
+
</div>
|
| 128 |
+
</div>
|
| 129 |
+
|
| 130 |
+
<div id="confirmation">
|
| 131 |
+
<h2>Confirm Your Details:</h2>
|
| 132 |
+
<p><strong>Name:</strong> <span id="confirmName"></span></p>
|
| 133 |
+
<p><strong>Email:</strong> <span id="confirmEmail"></span></p>
|
| 134 |
+
<p><strong>Phone:</strong> <span id="confirmPhone"></span></p>
|
| 135 |
+
<button class="confirm-button" onclick="autoSubmit()">Confirm</button>
|
| 136 |
+
</div>
|
| 137 |
+
|
| 138 |
+
<script>
|
| 139 |
+
let recognition;
|
| 140 |
+
if ('webkitSpeechRecognition' in window) {
|
| 141 |
+
recognition = new webkitSpeechRecognition();
|
| 142 |
+
recognition.continuous = false;
|
| 143 |
+
recognition.interimResults = false;
|
| 144 |
+
recognition.lang = 'en-US';
|
| 145 |
+
} else {
|
| 146 |
+
alert("Speech Recognition API is not supported in this browser.");
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
function speak(text, callback) {
|
| 150 |
+
const speech = new SpeechSynthesisUtterance(text);
|
| 151 |
+
speech.onend = callback;
|
| 152 |
+
window.speechSynthesis.speak(speech);
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
function askLoginOrRegister() {
|
| 156 |
+
speak("Welcome to Biryani Hub. Say 'Register' to create an account or 'Login' to sign in.", function() {
|
| 157 |
+
recognition.start();
|
| 158 |
+
recognition.onresult = function(event) {
|
| 159 |
+
let response = event.results[0][0].transcript.trim().toLowerCase();
|
| 160 |
+
recognition.stop();
|
| 161 |
+
if (response.includes("register")) {
|
| 162 |
+
showRegistrationForm();
|
| 163 |
+
} else if (response.includes("login")) {
|
| 164 |
+
showLoginForm();
|
| 165 |
+
} else {
|
| 166 |
+
speak("I didn't understand. Please say 'Register' to sign up or 'Login' to sign in.", askLoginOrRegister);
|
| 167 |
+
}
|
| 168 |
+
};
|
| 169 |
+
});
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
function showRegistrationForm() {
|
| 173 |
+
document.getElementById('registrationForm').style.display = 'block';
|
| 174 |
+
document.getElementById('loginForm').style.display = 'none';
|
| 175 |
+
speak("Please say your name to begin registration.", startListeningForName);
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
function startListeningForName() {
|
| 179 |
+
recognition.start();
|
| 180 |
+
recognition.onresult = function(event) {
|
| 181 |
+
document.getElementById('name').value = event.results[0][0].transcript.trim();
|
| 182 |
+
recognition.stop();
|
| 183 |
+
autoConfirm();
|
| 184 |
+
};
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
function autoConfirm() {
|
| 188 |
+
document.getElementById('confirmName').textContent = document.getElementById('name').value;
|
| 189 |
+
document.getElementById('confirmEmail').textContent = document.getElementById('email').value;
|
| 190 |
+
document.getElementById('confirmPhone').textContent = document.getElementById('mobile').value;
|
| 191 |
+
document.getElementById('confirmation').style.display = 'block';
|
| 192 |
+
setTimeout(autoSubmit, 3000);
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
function autoSubmit() {
|
| 196 |
+
var name = document.getElementById('name').value;
|
| 197 |
+
var email = document.getElementById('email').value;
|
| 198 |
+
var phone = document.getElementById('mobile').value;
|
| 199 |
+
fetch('/submit', {
|
| 200 |
+
method: 'POST',
|
| 201 |
+
headers: { 'Content-Type': 'application/json' },
|
| 202 |
+
body: JSON.stringify({ name: name, email: email, phone: phone })
|
| 203 |
+
})
|
| 204 |
+
.then(response => response.json())
|
| 205 |
+
.then(data => {
|
| 206 |
+
if (data.success) {
|
| 207 |
+
speak("Your registration is complete. Thank you for registering.");
|
| 208 |
+
setTimeout(() => location.reload(), 5000);
|
| 209 |
+
} else {
|
| 210 |
+
speak("There was an error submitting your details. Please try again.");
|
| 211 |
+
}
|
| 212 |
+
});
|
| 213 |
+
}
|
| 214 |
+
|
| 215 |
+
window.onload = function () {
|
| 216 |
+
askLoginOrRegister();
|
| 217 |
+
};
|
| 218 |
+
</script>
|
| 219 |
+
</body>
|
| 220 |
+
</html>
|