Update templates/index.html
Browse files- templates/index.html +38 -42
templates/index.html
CHANGED
@@ -49,18 +49,7 @@
|
|
49 |
border-color: #ff6a00;
|
50 |
outline: none;
|
51 |
}
|
52 |
-
.
|
53 |
-
font-size: 16px;
|
54 |
-
color: #ff6a00;
|
55 |
-
font-weight: bold;
|
56 |
-
margin-top: 10px;
|
57 |
-
}
|
58 |
-
.status {
|
59 |
-
font-size: 14px;
|
60 |
-
color: gray;
|
61 |
-
margin-top: 10px;
|
62 |
-
}
|
63 |
-
.confirm-button, .switch-button {
|
64 |
padding: 10px 20px;
|
65 |
background-color: #ff6a00;
|
66 |
color: white;
|
@@ -69,19 +58,9 @@
|
|
69 |
cursor: pointer;
|
70 |
margin-top: 10px;
|
71 |
}
|
72 |
-
.confirm-button:hover
|
73 |
background-color: #e65e00;
|
74 |
}
|
75 |
-
.confirm-details {
|
76 |
-
margin-top: 20px;
|
77 |
-
font-size: 18px;
|
78 |
-
font-weight: bold;
|
79 |
-
color: #333;
|
80 |
-
}
|
81 |
-
.details {
|
82 |
-
font-size: 16px;
|
83 |
-
margin: 5px 0;
|
84 |
-
}
|
85 |
</style>
|
86 |
</head>
|
87 |
<body>
|
@@ -91,46 +70,39 @@
|
|
91 |
<p class="status" id="status">🔊 Please say 'new' to register or 'existing' to login.</p>
|
92 |
</div>
|
93 |
|
|
|
94 |
<div class="container" id="registrationForm" style="display: none;">
|
95 |
<h2>Register</h2>
|
96 |
<label for="name">Your Name</label>
|
97 |
-
<input type="text" id="name" placeholder="Listening for name..."
|
98 |
|
99 |
<label for="email">Your Email</label>
|
100 |
-
<input type="text" id="email" placeholder="Listening for email..."
|
101 |
|
102 |
<label for="mobile">Your Mobile Number</label>
|
103 |
-
<input type="text" id="mobile" placeholder="Listening for mobile number..."
|
104 |
|
105 |
<label for="password">Your Password</label>
|
106 |
-
<input type="password" id="password" placeholder="
|
107 |
|
108 |
<p class="status" id="registrationStatus">Listening... 🗣</p>
|
|
|
109 |
</div>
|
110 |
|
|
|
111 |
<div class="container" id="loginForm" style="display: none;">
|
112 |
<h2>Login</h2>
|
113 |
<label for="loginEmail">Your Email</label>
|
114 |
-
<input type="text" id="loginEmail" placeholder="Listening for email..."
|
115 |
|
116 |
<label for="loginMobile">Your Mobile Number</label>
|
117 |
-
<input type="text" id="loginMobile" placeholder="Listening for mobile number..."
|
118 |
|
119 |
<label for="loginPassword">Your Password</label>
|
120 |
-
<input type="password" id="loginPassword" placeholder="
|
121 |
|
122 |
<p class="status" id="loginStatus">Listening... 🗣</p>
|
123 |
-
|
124 |
-
|
125 |
-
<div class="container" id="confirmationPage" style="display: none;">
|
126 |
-
<h2>Confirm Your Details</h2>
|
127 |
-
<div class="confirm-details">
|
128 |
-
<p class="details"><strong>Name:</strong> <span id="confirmName"></span></p>
|
129 |
-
<p class="details"><strong>Email:</strong> <span id="confirmEmail"></span></p>
|
130 |
-
<p class="details"><strong>Phone:</strong> <span id="confirmPhone"></span></p>
|
131 |
-
<p class="details"><strong>Password:</strong> <span id="confirmPassword"></span></p>
|
132 |
-
</div>
|
133 |
-
<button class="confirm-button" onclick="submitRegistration()">Confirm & Submit</button>
|
134 |
</div>
|
135 |
|
136 |
<script>
|
@@ -158,6 +130,30 @@
|
|
158 |
alert('An error occurred. Please try again.');
|
159 |
});
|
160 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
</script>
|
162 |
</body>
|
163 |
-
</html>
|
|
|
49 |
border-color: #ff6a00;
|
50 |
outline: none;
|
51 |
}
|
52 |
+
.confirm-button {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
padding: 10px 20px;
|
54 |
background-color: #ff6a00;
|
55 |
color: white;
|
|
|
58 |
cursor: pointer;
|
59 |
margin-top: 10px;
|
60 |
}
|
61 |
+
.confirm-button:hover {
|
62 |
background-color: #e65e00;
|
63 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
</style>
|
65 |
</head>
|
66 |
<body>
|
|
|
70 |
<p class="status" id="status">🔊 Please say 'new' to register or 'existing' to login.</p>
|
71 |
</div>
|
72 |
|
73 |
+
<!-- Registration Form -->
|
74 |
<div class="container" id="registrationForm" style="display: none;">
|
75 |
<h2>Register</h2>
|
76 |
<label for="name">Your Name</label>
|
77 |
+
<input type="text" id="name" placeholder="Listening for name..." required>
|
78 |
|
79 |
<label for="email">Your Email</label>
|
80 |
+
<input type="text" id="email" placeholder="Listening for email..." required>
|
81 |
|
82 |
<label for="mobile">Your Mobile Number</label>
|
83 |
+
<input type="text" id="mobile" placeholder="Listening for mobile number..." required>
|
84 |
|
85 |
<label for="password">Your Password</label>
|
86 |
+
<input type="password" id="password" placeholder="Enter your password" required>
|
87 |
|
88 |
<p class="status" id="registrationStatus">Listening... 🗣</p>
|
89 |
+
<button class="confirm-button" onclick="submitRegistration()">Register</button>
|
90 |
</div>
|
91 |
|
92 |
+
<!-- Login Form -->
|
93 |
<div class="container" id="loginForm" style="display: none;">
|
94 |
<h2>Login</h2>
|
95 |
<label for="loginEmail">Your Email</label>
|
96 |
+
<input type="text" id="loginEmail" placeholder="Listening for email..." required>
|
97 |
|
98 |
<label for="loginMobile">Your Mobile Number</label>
|
99 |
+
<input type="text" id="loginMobile" placeholder="Listening for mobile number..." required>
|
100 |
|
101 |
<label for="loginPassword">Your Password</label>
|
102 |
+
<input type="password" id="loginPassword" placeholder="Enter your password" required>
|
103 |
|
104 |
<p class="status" id="loginStatus">Listening... 🗣</p>
|
105 |
+
<button class="confirm-button" onclick="submitLogin()">Login</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
</div>
|
107 |
|
108 |
<script>
|
|
|
130 |
alert('An error occurred. Please try again.');
|
131 |
});
|
132 |
}
|
133 |
+
|
134 |
+
function submitLogin() {
|
135 |
+
const email = document.getElementById('loginEmail').value;
|
136 |
+
const phone = document.getElementById('loginMobile').value;
|
137 |
+
const password = document.getElementById('loginPassword').value;
|
138 |
+
|
139 |
+
fetch('/login', {
|
140 |
+
method: 'POST',
|
141 |
+
headers: { 'Content-Type': 'application/json' },
|
142 |
+
body: JSON.stringify({ email, phone, password })
|
143 |
+
})
|
144 |
+
.then(response => response.json())
|
145 |
+
.then(data => {
|
146 |
+
if (data.success) {
|
147 |
+
alert('Login successful!');
|
148 |
+
window.location.href = '/dashboard';
|
149 |
+
} else {
|
150 |
+
alert('Error: ' + data.error);
|
151 |
+
}
|
152 |
+
})
|
153 |
+
.catch(error => {
|
154 |
+
alert('An error occurred. Please try again.');
|
155 |
+
});
|
156 |
+
}
|
157 |
</script>
|
158 |
</body>
|
159 |
+
</html>
|