DatPro commited on
Commit
a4a1e94
·
verified ·
1 Parent(s): 2eb727c

Add 2 files

Browse files
Files changed (2) hide show
  1. index.html +319 -2
  2. prompts.txt +2 -1
index.html CHANGED
@@ -69,6 +69,13 @@
69
  .input-field:focus {
70
  background: rgba(255, 255, 255, 0.2);
71
  }
 
 
 
 
 
 
 
72
  </style>
73
  </head>
74
  <body class="bg-gray-100 font-sans">
@@ -114,7 +121,7 @@
114
  </div>
115
 
116
  <div class="text-sm">
117
- <a href="#" class="font-medium text-white hover:underline">
118
  Quên mật khẩu?
119
  </a>
120
  </div>
@@ -170,6 +177,158 @@
170
  </div>
171
  </div>
172
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
  <!-- Dashboard (hidden by default) -->
174
  <div id="dashboard" class="hidden flex h-screen overflow-hidden">
175
  <!-- Sidebar -->
@@ -465,7 +624,7 @@
465
  </tr>
466
  <tr class="hover:bg-gray-50">
467
  <td class="px-4 py-4 whitespace-nowrap text-sm font-medium text-indigo-600">#DH-2456</td>
468
- <td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">Phạm Văn Cường</td>
469
  <td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">14/06/2023</td>
470
  <td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">2,150,000₫</td>
471
  <td class="px-4 py-4 whitespace-nowrap">
@@ -575,6 +734,9 @@
575
  if (loggedInUser) {
576
  showDashboard(JSON.parse(loggedInUser));
577
  }
 
 
 
578
  });
579
 
580
  // Login Form Submission
@@ -608,6 +770,116 @@
608
  showDashboard(user);
609
  });
610
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
611
  // Logout Button
612
  document.getElementById('logoutBtn').addEventListener('click', function(e) {
613
  e.preventDefault();
@@ -629,6 +901,51 @@
629
  initCharts();
630
  }
631
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
632
  // Initialize Charts
633
  function initCharts() {
634
  // Sales Chart
 
69
  .input-field:focus {
70
  background: rgba(255, 255, 255, 0.2);
71
  }
72
+ .otp-input {
73
+ width: 50px;
74
+ height: 50px;
75
+ text-align: center;
76
+ font-size: 18px;
77
+ margin: 0 5px;
78
+ }
79
  </style>
80
  </head>
81
  <body class="bg-gray-100 font-sans">
 
121
  </div>
122
 
123
  <div class="text-sm">
124
+ <a href="#" id="forgotPasswordLink" class="font-medium text-white hover:underline">
125
  Quên mật khẩu?
126
  </a>
127
  </div>
 
177
  </div>
178
  </div>
179
 
180
+ <!-- Forgot Password Screen (hidden by default) -->
181
+ <div id="forgotPasswordScreen" class="hidden min-h-screen flex items-center justify-center login-container p-4">
182
+ <div class="login-card rounded-2xl shadow-xl overflow-hidden w-full max-w-md p-8">
183
+ <div class="text-center mb-8">
184
+ <i class="fas fa-key text-5xl text-white mb-4"></i>
185
+ <h1 class="text-3xl font-bold text-white">Khôi phục mật khẩu</h1>
186
+ <p class="text-white opacity-80 mt-2">Nhập email đăng ký để nhận mã xác thực</p>
187
+ </div>
188
+
189
+ <form id="forgotPasswordForm" class="space-y-6">
190
+ <div>
191
+ <label for="recoveryEmail" class="block text-sm font-medium text-white mb-1">Email đăng ký</label>
192
+ <div class="relative">
193
+ <div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
194
+ <i class="fas fa-envelope text-white opacity-70"></i>
195
+ </div>
196
+ <input type="email" id="recoveryEmail" name="recoveryEmail" required
197
+ class="input-field w-full pl-10 pr-3 py-3 rounded-lg text-white placeholder-white opacity-80 focus:outline-none focus:ring-2 focus:ring-white">
198
+ </div>
199
+ </div>
200
+
201
+ <div>
202
+ <button type="submit"
203
+ class="w-full flex justify-center py-3 px-4 border border-transparent rounded-lg shadow-sm text-sm font-medium text-indigo-700 bg-white hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-white transition duration-150">
204
+ Gửi mã xác thực
205
+ </button>
206
+ </div>
207
+ </form>
208
+
209
+ <div class="mt-6 text-center">
210
+ <a href="#" id="backToLoginLink" class="text-sm font-medium text-white hover:underline">
211
+ <i class="fas fa-arrow-left mr-1"></i> Quay lại đăng nhập
212
+ </a>
213
+ </div>
214
+ </div>
215
+ </div>
216
+
217
+ <!-- OTP Verification Screen (hidden by default) -->
218
+ <div id="otpScreen" class="hidden min-h-screen flex items-center justify-center login-container p-4">
219
+ <div class="login-card rounded-2xl shadow-xl overflow-hidden w-full max-w-md p-8">
220
+ <div class="text-center mb-8">
221
+ <i class="fas fa-shield-alt text-5xl text-white mb-4"></i>
222
+ <h1 class="text-3xl font-bold text-white">Xác thực OTP</h1>
223
+ <p class="text-white opacity-80 mt-2">Mã xác thực đã được gửi đến <span id="emailDisplay" class="font-medium">example@email.com</span></p>
224
+ </div>
225
+
226
+ <form id="otpForm" class="space-y-6">
227
+ <div class="flex justify-center">
228
+ <input type="text" maxlength="1" class="otp-input rounded-lg input-field text-white text-center" pattern="\d*">
229
+ <input type="text" maxlength="1" class="otp-input rounded-lg input-field text-white text-center" pattern="\d*">
230
+ <input type="text" maxlength="1" class="otp-input rounded-lg input-field text-white text-center" pattern="\d*">
231
+ <input type="text" maxlength="1" class="otp-input rounded-lg input-field text-white text-center" pattern="\d*">
232
+ <input type="text" maxlength="1" class="otp-input rounded-lg input-field text-white text-center" pattern="\d*">
233
+ <input type="text" maxlength="1" class="otp-input rounded-lg input-field text-white text-center" pattern="\d*">
234
+ </div>
235
+
236
+ <div class="text-center text-sm text-white opacity-80">
237
+ <p>Bạn chưa nhận được mã? <a href="#" class="font-medium hover:underline">Gửi lại</a></p>
238
+ <p class="mt-1" id="countdown">Mã có hiệu lực trong 03:00</p>
239
+ </div>
240
+
241
+ <div>
242
+ <button type="submit"
243
+ class="w-full flex justify-center py-3 px-4 border border-transparent rounded-lg shadow-sm text-sm font-medium text-indigo-700 bg-white hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-white transition duration-150">
244
+ Xác thực
245
+ </button>
246
+ </div>
247
+ </form>
248
+
249
+ <div class="mt-6 text-center">
250
+ <a href="#" id="backToForgotPasswordLink" class="text-sm font-medium text-white hover:underline">
251
+ <i class="fas fa-arrow-left mr-1"></i> Quay lại
252
+ </a>
253
+ </div>
254
+ </div>
255
+ </div>
256
+
257
+ <!-- New Password Screen (hidden by default) -->
258
+ <div id="newPasswordScreen" class="hidden min-h-screen flex items-center justify-center login-container p-4">
259
+ <div class="login-card rounded-2xl shadow-xl overflow-hidden w-full max-w-md p-8">
260
+ <div class="text-center mb-8">
261
+ <i class="fas fa-lock-open text-5xl text-white mb-4"></i>
262
+ <h1 class="text-3xl font-bold text-white">Đặt lại mật khẩu</h1>
263
+ <p class="text-white opacity-80 mt-2">Vui lòng nhập mật khẩu mới cho tài khoản của bạn</p>
264
+ </div>
265
+
266
+ <form id="newPasswordForm" class="space-y-6">
267
+ <div>
268
+ <label for="newPassword" class="block text-sm font-medium text-white mb-1">Mật khẩu mới</label>
269
+ <div class="relative">
270
+ <div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
271
+ <i class="fas fa-lock text-white opacity-70"></i>
272
+ </div>
273
+ <input type="password" id="newPassword" name="newPassword" required
274
+ class="input-field w-full pl-10 pr-3 py-3 rounded-lg text-white placeholder-white opacity-80 focus:outline-none focus:ring-2 focus:ring-white">
275
+ </div>
276
+ <p class="text-xs text-white opacity-60 mt-1">Mật khẩu phải có ít nhất 8 ký tự</p>
277
+ </div>
278
+
279
+ <div>
280
+ <label for="confirmPassword" class="block text-sm font-medium text-white mb-1">Xác nhận mật khẩu</label>
281
+ <div class="relative">
282
+ <div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
283
+ <i class="fas fa-lock text-white opacity-70"></i>
284
+ </div>
285
+ <input type="password" id="confirmPassword" name="confirmPassword" required
286
+ class="input-field w-full pl-10 pr-3 py-3 rounded-lg text-white placeholder-white opacity-80 focus:outline-none focus:ring-2 focus:ring-white">
287
+ </div>
288
+ </div>
289
+
290
+ <div class="flex items-center">
291
+ <input id="showPassword" name="showPassword" type="checkbox"
292
+ class="h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded">
293
+ <label for="showPassword" class="ml-2 block text-sm text-white opacity-80">
294
+ Hiển thị mật khẩu
295
+ </label>
296
+ </div>
297
+
298
+ <div>
299
+ <button type="submit"
300
+ class="w-full flex justify-center py-3 px-4 border border-transparent rounded-lg shadow-sm text-sm font-medium text-indigo-700 bg-white hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-white transition duration-150">
301
+ Cập nhật mật khẩu
302
+ </button>
303
+ </div>
304
+ </form>
305
+
306
+ <div class="mt-6 text-center">
307
+ <a href="#" id="backToOtpLink" class="text-sm font-medium text-white hover:underline">
308
+ <i class="fas fa-arrow-left mr-1"></i> Quay lại
309
+ </a>
310
+ </div>
311
+ </div>
312
+ </div>
313
+
314
+ <!-- Success Message Screen (hidden by default) -->
315
+ <div id="successScreen" class="hidden min-h-screen flex items-center justify-center login-container p-4">
316
+ <div class="login-card rounded-2xl shadow-xl overflow-hidden w-full max-w-md p-8 text-center">
317
+ <div class="mb-8">
318
+ <div class="w-20 h-20 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-4">
319
+ <i class="fas fa-check text-4xl text-green-600"></i>
320
+ </div>
321
+ <h1 class="text-3xl font-bold text-white">Thành công!</h1>
322
+ <p class="text-white opacity-80 mt-2">Mật khẩu của bạn đã được cập nhật thành công</p>
323
+ </div>
324
+
325
+ <a href="#" id="backToLoginFromSuccess"
326
+ class="inline-flex justify-center py-3 px-6 border border-transparent rounded-lg shadow-sm text-sm font-medium text-indigo-700 bg-white hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-white transition duration-150">
327
+ Đăng nhập ngay
328
+ </a>
329
+ </div>
330
+ </div>
331
+
332
  <!-- Dashboard (hidden by default) -->
333
  <div id="dashboard" class="hidden flex h-screen overflow-hidden">
334
  <!-- Sidebar -->
 
624
  </tr>
625
  <tr class="hover:bg-gray-50">
626
  <td class="px-4 py-4 whitespace-nowrap text-sm font-medium text-indigo-600">#DH-2456</td>
627
+ <td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">Phạм Văn Cường</td>
628
  <td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">14/06/2023</td>
629
  <td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">2,150,000₫</td>
630
  <td class="px-4 py-4 whitespace-nowrap">
 
734
  if (loggedInUser) {
735
  showDashboard(JSON.parse(loggedInUser));
736
  }
737
+
738
+ // Initialize OTP input fields
739
+ initOtpInputs();
740
  });
741
 
742
  // Login Form Submission
 
770
  showDashboard(user);
771
  });
772
 
773
+ // Forgot Password Link
774
+ document.getElementById('forgotPasswordLink').addEventListener('click', function(e) {
775
+ e.preventDefault();
776
+ document.getElementById('loginScreen').classList.add('hidden');
777
+ document.getElementById('forgotPasswordScreen').classList.remove('hidden');
778
+ });
779
+
780
+ // Back to Login from Forgot Password
781
+ document.getElementById('backToLoginLink').addEventListener('click', function(e) {
782
+ e.preventDefault();
783
+ document.getElementById('forgotPasswordScreen').classList.add('hidden');
784
+ document.getElementById('loginScreen').classList.remove('hidden');
785
+ });
786
+
787
+ // Forgot Password Form Submission
788
+ document.getElementById('forgotPasswordForm').addEventListener('submit', function(e) {
789
+ e.preventDefault();
790
+
791
+ const email = document.getElementById('recoveryEmail').value;
792
+
793
+ if (!email) {
794
+ alert('Vui lòng nhập email đăng ký');
795
+ return;
796
+ }
797
+
798
+ // In a real app, you would send this to a server to send OTP
799
+ // For demo, we'll just simulate it
800
+ document.getElementById('emailDisplay').textContent = email;
801
+ document.getElementById('forgotPasswordScreen').classList.add('hidden');
802
+ document.getElementById('otpScreen').classList.remove('hidden');
803
+
804
+ // Start countdown timer
805
+ startCountdown();
806
+ });
807
+
808
+ // Back to Forgot Password from OTP
809
+ document.getElementById('backToForgotPasswordLink').addEventListener('click', function(e) {
810
+ e.preventDefault();
811
+ document.getElementById('otpScreen').classList.add('hidden');
812
+ document.getElementById('forgotPasswordScreen').classList.remove('hidden');
813
+ });
814
+
815
+ // OTP Form Submission
816
+ document.getElementById('otpForm').addEventListener('submit', function(e) {
817
+ e.preventDefault();
818
+
819
+ // Get all OTP inputs
820
+ const otpInputs = document.querySelectorAll('.otp-input');
821
+ let otp = '';
822
+
823
+ otpInputs.forEach(input => {
824
+ otp += input.value;
825
+ });
826
+
827
+ if (otp.length !== 6) {
828
+ alert('Vui lòng nhập đủ 6 chữ số mã OTP');
829
+ return;
830
+ }
831
+
832
+ // In a real app, you would verify OTP with server
833
+ // For demo, we'll just accept any 6-digit code
834
+ document.getElementById('otpScreen').classList.add('hidden');
835
+ document.getElementById('newPasswordScreen').classList.remove('hidden');
836
+ });
837
+
838
+ // Back to OTP from New Password
839
+ document.getElementById('backToOtpLink').addEventListener('click', function(e) {
840
+ e.preventDefault();
841
+ document.getElementById('newPasswordScreen').classList.add('hidden');
842
+ document.getElementById('otpScreen').classList.remove('hidden');
843
+ });
844
+
845
+ // Show Password Toggle
846
+ document.getElementById('showPassword').addEventListener('change', function(e) {
847
+ const passwordInputs = document.querySelectorAll('#newPasswordScreen input[type="password"]');
848
+ passwordInputs.forEach(input => {
849
+ input.type = e.target.checked ? 'text' : 'password';
850
+ });
851
+ });
852
+
853
+ // New Password Form Submission
854
+ document.getElementById('newPasswordForm').addEventListener('submit', function(e) {
855
+ e.preventDefault();
856
+
857
+ const newPassword = document.getElementById('newPassword').value;
858
+ const confirmPassword = document.getElementById('confirmPassword').value;
859
+
860
+ if (newPassword.length < 8) {
861
+ alert('Mật khẩu phải có ít nhất 8 ký tự');
862
+ return;
863
+ }
864
+
865
+ if (newPassword !== confirmPassword) {
866
+ alert('Mật khẩu xác nhận không khớp');
867
+ return;
868
+ }
869
+
870
+ // In a real app, you would send new password to server
871
+ // For demo, we'll just show success screen
872
+ document.getElementById('newPasswordScreen').classList.add('hidden');
873
+ document.getElementById('successScreen').classList.remove('hidden');
874
+ });
875
+
876
+ // Back to Login from Success
877
+ document.getElementById('backToLoginFromSuccess').addEventListener('click', function(e) {
878
+ e.preventDefault();
879
+ document.getElementById('successScreen').classList.add('hidden');
880
+ document.getElementById('loginScreen').classList.remove('hidden');
881
+ });
882
+
883
  // Logout Button
884
  document.getElementById('logoutBtn').addEventListener('click', function(e) {
885
  e.preventDefault();
 
901
  initCharts();
902
  }
903
 
904
+ // Initialize OTP Input Fields
905
+ function initOtpInputs() {
906
+ const otpInputs = document.querySelectorAll('.otp-input');
907
+
908
+ otpInputs.forEach((input, index) => {
909
+ // Only allow numbers
910
+ input.addEventListener('input', function() {
911
+ this.value = this.value.replace(/[^0-9]/g, '');
912
+
913
+ // Auto focus to next input
914
+ if (this.value.length === 1 && index < otpInputs.length - 1) {
915
+ otpInputs[index + 1].focus();
916
+ }
917
+ });
918
+
919
+ // Handle backspace
920
+ input.addEventListener('keydown', function(e) {
921
+ if (e.key === 'Backspace' && this.value.length === 0 && index > 0) {
922
+ otpInputs[index - 1].focus();
923
+ }
924
+ });
925
+ });
926
+ }
927
+
928
+ // Start Countdown Timer
929
+ function startCountdown() {
930
+ let timeLeft = 180; // 3 minutes in seconds
931
+ const countdownElement = document.getElementById('countdown');
932
+
933
+ const timer = setInterval(function() {
934
+ const minutes = Math.floor(timeLeft / 60);
935
+ const seconds = timeLeft % 60;
936
+
937
+ countdownElement.textContent = `Mã có hiệu lực trong ${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
938
+
939
+ if (timeLeft <= 0) {
940
+ clearInterval(timer);
941
+ countdownElement.textContent = 'Mã đã hết hiệu lực';
942
+ countdownElement.classList.add('text-red-400');
943
+ } else {
944
+ timeLeft--;
945
+ }
946
+ }, 1000);
947
+ }
948
+
949
  // Initialize Charts
950
  function initCharts() {
951
  // Sales Chart
prompts.txt CHANGED
@@ -1,2 +1,3 @@
1
  tạo cho tôi một trang web quản lý bán hàng đa nền tảng
2
- Thêm tính năng đăng nhập
 
 
1
  tạo cho tôi một trang web quản lý bán hàng đa nền tảng
2
+ Thêm tính năng đăng nhập
3
+ khi nhấn vào phần quên mật khẩu sẽ hiện ra các mục là gmail đăng ký, sau đó sẽ hiện thông tin là đã gửi mã xác thực vào email để đăng nhập vào vào ô Mã OTP để cập nhập lại mật khẩu