Skip to content

Commit 0186ed7

Browse files
authored
Updated security
1 parent 8bba941 commit 0186ed7

1 file changed

Lines changed: 26 additions & 9 deletions

File tree

‎index.html‎

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ <h2>Featured Projects</h2>
748748
</div>
749749
<div class="projects-grid">
750750

751-
<!-- Project 1: Mobile Prototype (Matches Screenshot) -->
751+
<!-- Project 1: Mobile Prototype -->
752752
<div class="project-card">
753753
<div class="project-image">
754754
<i class="fa-solid fa-mobile-screen-button"></i>
@@ -766,7 +766,7 @@ <h3>Mobile App Prototype</h3>
766766
</div>
767767
</div>
768768

769-
<!-- Project 2: Web Development -->
769+
<!-- Project 2 -->
770770
<div class="project-card">
771771
<div class="project-image">
772772
<i class="fa-solid fa-chart-simple"></i>
@@ -783,7 +783,7 @@ <h3>Empty Card</h3>
783783
</div>
784784
</div>
785785

786-
<!-- Project 3: AI & Cloud -->
786+
<!-- Project 3 -->
787787
<div class="project-card">
788788
<div class="project-image">
789789
<i class="fa-solid fa-robot"></i>
@@ -849,11 +849,19 @@ <h4>Location</h4>
849849
</div>
850850
</div>
851851

852-
<!-- Contact Form (Functional) -->
852+
<!-- Contact Form (Protected from Spam) -->
853853
<form id="contactForm" class="contact-form">
854-
<!-- Hidden Configs for FormSubmit -->
854+
<!-- 1. Hidden Configs for FormSubmit -->
855855
<input type="hidden" name="_subject" value="New Portfolio Submission!">
856-
<input type="hidden" name="_captcha" value="false">
856+
857+
<!-- 2. Re-enable Captcha (Set to true) -->
858+
<input type="hidden" name="_captcha" value="true">
859+
860+
<!-- 3. Honeypot (Invisible to humans, catches bots) -->
861+
<input type="text" name="_honey" style="display:none">
862+
863+
<!-- 4. Keyword Blacklist (Blocks common spam triggers) -->
864+
<input type="hidden" name="_blacklist" value="crypto, casino, bitcoin, forex, SEO, marketing, payout, promotion">
857865

858866
<div class="form-group">
859867
<label class="form-label">Name</label>
@@ -919,8 +927,15 @@ <h4>Location</h4>
919927
const spinner = document.getElementById('spinner');
920928

921929
form.addEventListener('submit', function(e) {
922-
e.preventDefault(); // Stop page refresh
930+
e.preventDefault();
923931

932+
// SECURITY CHECK: If the honeypot field is filled, it's a bot.
933+
const honey = form.querySelector('input[name="_honey"]').value;
934+
if (honey) {
935+
console.warn("Spam bot detected.");
936+
return; // Stop the script here
937+
}
938+
924939
// Show loading state
925940
spinner.style.display = 'inline-block';
926941

@@ -938,7 +953,10 @@ <h4>Location</h4>
938953
},
939954
body: json
940955
})
941-
.then(response => response.json())
956+
.then(response => {
957+
if (!response.ok) throw new Error('Response error');
958+
return response.json();
959+
})
942960
.then(data => {
943961
// Success
944962
messageDiv.style.display = 'block';
@@ -963,5 +981,4 @@ <h4>Location</h4>
963981
});
964982
</script>
965983
</body>
966-
967984
</html>

0 commit comments

Comments
 (0)