source: interfejs/verify-email.html@ 591278c

finki-main main
Last change on this file since 591278c was 69f2a41, checked in by Klimentina Efremova <klimentina08642@…>, 7 months ago

Initial commit

  • Property mode set to 100644
File size: 4.1 KB
Line 
1<!DOCTYPE html>
2<html lang="en">
3<head>
4 <meta charset="UTF-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 <title>Verify Email - Handcraft Marketplace</title>
7 <link rel="stylesheet" href="style.css">
8</head>
9<body>
10<header>
11 <div class="logo-container">
12 <img src="../images/administrative/logo.jpg" alt="Handcraft Marketplace Logo" onerror="this.style.display='none'">
13 <h1>🎨 Handcraft Marketplace</h1>
14 </div>
15 <nav>
16 <ul>
17 <li><a href="index.html">Home</a></li>
18 <li><a href="products.html">Products</a></li>
19 <li><a href="login.html">Login</a></li>
20 </ul>
21 </nav>
22</header>
23
24<main>
25 <div class="form-container">
26 <h2>Verify Your Email</h2>
27 <p class="form-subtitle">Enter the verification code sent to your email</p>
28
29 <form id="verify-email-form" class="form">
30 <div class="form-group">
31 <label for="code">Verification Code</label>
32 <input type="text" id="code" maxlength="6" placeholder="000000" required>
33 </div>
34
35 <div class="form-group">
36 <button type="submit" class="btn-primary btn-full">Verify</button>
37 </div>
38 </form>
39
40 <div class="form-footer">
41 <p>Didn't receive code? <a href="#" id="resend-code">Resend</a></p>
42 <p><a href="register.html">Back to Registration</a></p>
43 </div>
44 </div>
45</main>
46
47<footer>
48 <div class="footer-content">
49 <div class="footer-section">
50 <h3>Handcraft Marketplace</h3>
51 <p>Connecting artisans with buyers worldwide</p>
52 </div>
53 <div class="footer-section">
54 <h3>Quick Links</h3>
55 <ul>
56 <li><a href="index.html">Home</a></li>
57 <li><a href="products.html">Products</a></li>
58 </ul>
59 </div>
60 </div>
61 <div class="footer-bottom">
62 <p>&copy; 2025 Handcraft Marketplace. All rights reserved.</p>
63 </div>
64</footer>
65
66<script src="script.js"></script>
67<script>
68 document.addEventListener('DOMContentLoaded', () => {
69 const urlParams = new URLSearchParams(window.location.search);
70 const email = urlParams.get('email');
71
72 const form = document.getElementById('verify-email-form');
73 form.addEventListener('submit', async (e) => {
74 e.preventDefault();
75
76 const code = document.getElementById('code').value;
77
78 try {
79 const response = await fetch('/api/verify-email', {
80 method: 'POST',
81 headers: { 'Content-Type': 'application/json' },
82 body: JSON.stringify({ email, code })
83 });
84
85 const data = await response.json();
86
87 if (data.success) {
88 alert('Email verified successfully!');
89 window.location.href = data.redirectTo || 'login.html';
90 } else {
91 alert(data.message || 'Verification failed');
92 }
93 } catch (error) {
94 console.error('Verification error:', error);
95 alert('An error occurred');
96 }
97 });
98
99 document.getElementById('resend-code').addEventListener('click', async (e) => {
100 e.preventDefault();
101
102 try {
103 const response = await fetch('/api/resend-verification', {
104 method: 'POST',
105 headers: { 'Content-Type': 'application/json' },
106 body: JSON.stringify({ email })
107 });
108
109 const data = await response.json();
110
111 if (data.success) {
112 alert('New verification code sent!');
113 if (data.developmentCode) {
114 console.log('New code:', data.developmentCode);
115 }
116 } else {
117 alert(data.message || 'Failed to resend code');
118 }
119 } catch (error) {
120 console.error('Resend error:', error);
121 alert('An error occurred');
122 }
123 });
124 });
125</script>
126</body>
127</html>
Note: See TracBrowser for help on using the repository browser.