-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontact.html
More file actions
212 lines (188 loc) · 10 KB
/
contact.html
File metadata and controls
212 lines (188 loc) · 10 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Contact — Safenet</title>
<meta name="description" content="Contact Safenet — contact form.">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="assets/css/style.css" rel="stylesheet">
</head>
</head>
<body>
<a class="visually-hidden-focusable" href="#main">Skip to main content</a>
<nav class="navbar navbar-expand-lg navbar-light bg-white border-bottom sticky-top">
<div class="container">
<a class="navbar-brand d-flex align-items-center" href="index.html">
<img src="assets/images/logo.svg" class="logo me-2" width="36" height="36" alt="Safenet logo">
<span class="brand-text">SafeNet</span>
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#nav" aria-controls="nav"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="nav">
<ul class="navbar-nav ms-auto">
<li class="nav-item"><a class="nav-link" href="index.html">Home</a></li>
<li class="nav-item"><a class="nav-link" href="accounts-passwords.html">Guides</a></li>
<li class="nav-item"><a class="nav-link" href="about.html">About</a></li>
<li class="nav-item"><a class="nav-link" href="contact.html">Contact</a></li>
</ul>
</div>
</div>
</nav>
<main id="main" class="container py-5">
<header class="mb-4">
<h1 class="h3">Contact</h1>
<p class="text-muted">Use this form for non-urgent requests or to report issues. The form demonstrates a
client-side preview workflow and a mailto fallback.</p>
</header>
<div class="row">
<div class="col-lg-6">
<form id="contact-form" novalidate>
<div class="mb-3">
<label for="name" class="form-label">Name (optional)</label>
<input id="name" name="name" class="form-control" type="text" placeholder="Your name">
</div>
<div class="mb-3">
<label for="email" class="form-label">Email (required)</label>
<input id="email" name="email" class="form-control" type="email" placeholder="you@example.org" required
aria-required="true">
<div class="invalid-feedback">Please enter a valid email address so we can respond.</div>
</div>
<div class="mb-3">
<label for="subject" class="form-label">Subject</label>
<input id="subject" name="subject" class="form-control" type="text" placeholder="Short subject">
</div>
<div class="mb-3">
<label for="message" class="form-label">Message (required)</label>
<textarea id="message" name="message" rows="6" class="form-control" required aria-required="true"
placeholder="Describe the issue or question"></textarea>
<div class="invalid-feedback">Please provide a short message describing your issue.</div>
</div>
<!-- Honeypot anti-spam (hidden from users) -->
<div class="honeypot" aria-hidden="true">
<label for="website" class="form-label">Website</label>
<input id="website" name="website" type="text" autocomplete="off">
</div>
<div class="mb-3 form-check">
<input id="consent" name="consent" type="checkbox" class="form-check-input">
<label for="consent" class="form-check-label">I consent to my message being used to respond to this request.
See <a href="#">privacy</a>.</label>
</div>
<div class="d-flex gap-2">
<button id="send" type="submit" class="btn btn-primary">Send (preview)</button>
<!-- <button id="mailto" type="button" class="btn btn-outline-secondary">Open in mail client</button> -->
<button id="clear" type="button" class="btn btn-outline-secondary">Clear</button>
</div>
</form>
<div id="notice" class="mt-3" aria-live="polite"></div>
</div>
<aside class="col-lg-4">
<div class="card mb-3">
<div class="card-body">
<h3 class="h6">Other ways to contact</h3>
<p class="mb-1"><strong>Phone:</strong> <a href="tel:+00001234567">+0 000 123 4567</a></p>
<p class="mb-0"><strong>Email:</strong> <a href="mailto:security@example.org">security@example.org</a></p>
</div>
</div>
<div class="card">
<div class="card-body small text-muted">
<strong>Privacy note</strong>
<p class="mb-0">This site is testing purpose only and built for the project submission. his example copies a
preview to the clipboard instead of sending it. Keep sensitive information on your device and do not paste
it into unknown third-party sites or services. Store backup codes or recovery details securely offline or
in a trusted password manager.</p>
</div>
</div>
</aside>
</div>
</main>
<footer class="bg-light py-3 border-top">
<div class="container d-flex justify-content-between align-items-center small text-muted">
<div>© Safenet — CyberSafeHaven</div>
<div class="social-links">
<a href="https://x.com" target="_blank" rel="noopener noreferrer" aria-label="Visit X homepage">
<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg">
<path d="M5 5 L19 19 M19 5 L5 19" stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round" fill="none" />
</svg>
<span class="visually-hidden">X homepage</span>
</a>
<a href="https://www.facebook.com" target="_blank" rel="noopener noreferrer"
aria-label="Visit Facebook homepage">
<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg">
<path d="M15 8h2V5h-2c-1.1 0-2 .9-2 2v1H11v3h2v7h3v-7h2.5l.5-3H16v-1c0-.28.22-0.5.5-0.5z"
fill="currentColor" />
</svg>
<span class="visually-hidden">Facebook homepage</span>
</a>
<a href="https://www.linkedin.com" target="_blank" rel="noopener noreferrer"
aria-label="Visit LinkedIn homepage">
<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg">
<rect x="2" y="3" width="4" height="14" rx="1" fill="currentColor" />
<circle cx="4" cy="6" r="1.3" fill="#fff" />
<path
d="M9 8h3v1.8c.4-.7 1.6-1.4 3.1-1.4 3.3 0 4 2.2 4 5.1V20h-4v-5.2c0-1.2 0-2.8-1.7-2.8-1.7 0-2 1.4-2 2.7V20H9V8z"
fill="currentColor" />
</svg>
<span class="visually-hidden">LinkedIn homepage</span>
</a>
<a href="https://mastodon.social" target="_blank" rel="noopener noreferrer"
aria-label="Visit Mastodon homepage">
<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg">
<path d="M12 2C7 2 4 5.5 4 9.2c0 3.2 1.4 6 4 7.7V22l3-1 3 1v-5.1c2.6-1.6 4-4.5 4-7.7C20 5.5 17 2 12 2z"
fill="currentColor" />
<circle cx="8.5" cy="10" r="1" fill="#fff" />
<path d="M14 9.5c0 .8-.6 1.5-1.3 1.5s-1.2-.7-1.2-1.5.5-1.5 1.2-1.5S14 8.7 14 9.5z" fill="#fff" />
</svg>
<span class="visually-hidden">Mastodon homepage</span>
</a>
</div>
</div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<script>
(function () {
const form = document.getElementById('contact-form');
const email = document.getElementById('email');
const message = document.getElementById('message');
const website = document.getElementById('website'); // honeypot
const notice = document.getElementById('notice');
const mailtoBtn = document.getElementById('mailto');
const clearBtn = document.getElementById('clear');
function validate() {
let valid = true;
[email, message].forEach(el => {
if (!el.checkValidity()) { el.classList.add('is-invalid'); valid = false } else { el.classList.remove('is-invalid') }
});
return valid;
}
form.addEventListener('submit', function (e) {
e.preventDefault();
notice.textContent = '';
// simple spam check: honeypot must be empty
if (website && website.value) { notice.textContent = 'Suspicious submission detected.'; return }
if (!validate()) { notice.textContent = 'Please fix validation errors and try again.'; return }
// Show a preview and copy to clipboard
const payload = {
name: form.name.value,
email: form.email.value,
subject: form.subject.value,
message: form.message.value
};
const preview = `To: security@example.org\nSubject: ${payload.subject || '[no subject]'}\n\n${payload.message}\n\n—from ${payload.name || payload.email}`;
// copy to clipboard if available
if (navigator.clipboard) { navigator.clipboard.writeText(preview).then(() => { notice.textContent = 'Preview copied to clipboard.' }); }
else { notice.textContent = 'Preview ready.' }
});
mailtoBtn.addEventListener('click', function () {
const subj = encodeURIComponent(document.getElementById('subject').value || 'Safenet contact');
const body = encodeURIComponent((document.getElementById('message').value || '') + '\n\n—from: ' + (document.getElementById('name').value || document.getElementById('email').value || ''));
window.location.href = `mailto:security@example.org?subject=${subj}&body=${body}`;
});
clearBtn.addEventListener('click', function () { form.reset(); notice.textContent = 'Form cleared.' });
})();
</script>
</body>
</html>