Skip to content

Commit

Permalink
Update forgot-pass.html
Browse files Browse the repository at this point in the history
  • Loading branch information
Anjaliavv51 authored Oct 31, 2024
1 parent cf1e77a commit e2b04d5
Showing 1 changed file with 0 additions and 76 deletions.
76 changes: 0 additions & 76 deletions Html-files/forgot-pass.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,82 +24,6 @@ <h1>Forgot Password</h1>
<p class="switch-link">Remembered your password? <a href="login.html">Login</a></p>
</div>
</div>

<script>
const coords = { x: 0, y: 0 };
const circles = document.querySelectorAll(".circle");
const emailInput = document.getElementById('email');
const errorMessage = document.getElementById('error-message');

const colors = [
"#ffb56b", "#fdaf69", "#f89d63", "#f59761", "#ef865e",
"#ec805d", "#e36e5c", "#df685c", "#d5585c", "#d1525c",
"#c5415d", "#c03b5d", "#b22c5e", "#ac265e", "#9c155f",
"#950f5f", "#830060", "#7c0060", "#680060", "#60005f",
"#48005f", "#3d005e"
];

circles.forEach(function (circle, index) {
circle.x = 0;
circle.y = 0;
circle.style.backgroundColor = colors[index % colors.length];
});

window.addEventListener("mousemove", function (e) {
coords.x = e.clientX;
coords.y = e.clientY;
});

function animateCircles() {
let x = coords.x;
let y = coords.y;

circles.forEach(function (circle, index) {
circle.style.left = x - 12 + "px";
circle.style.top = y - 12 + "px";
circle.style.scale = (circles.length - index) / circles.length;

circle.x = x;
circle.y = y;

const nextCircle = circles[index + 1] || circles[0];
x += (nextCircle.x - x) * 0.3;
y += (nextCircle.y - y) * 0.3;
});

requestAnimationFrame(animateCircles);
}

animateCircles();

// Email validation function
function validateEmail(email) {
const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
return emailPattern.test(email);
}

// Real-time email validation
emailInput.addEventListener('input', function() {
if (validateEmail(emailInput.value)) {
errorMessage.textContent = '';
} else {
errorMessage.textContent = 'The email format is invalid. Ensure it includes “@” and a domain name (e.g., [email protected]).';
}
});

// Form submission event listener for password reset
document.getElementById('forgotPassForm').addEventListener('submit', function(event) {
event.preventDefault();

const emailInputValue = emailInput.value;

if (!validateEmail(emailInputValue)) {
errorMessage.textContent = 'The email format is invalid. Ensure it includes “@” and a domain name (e.g., [email protected]).';
} else {
window.location.assign('reset-confirmation.html');
}
});
</script>
<div class="gtranslate_wrapper"></div>
<script>window.gtranslateSettings = {"default_language":"en","detect_browser_language":true,"wrapper_selector":".gtranslate_wrapper"}</script>
<script src="https://cdn.gtranslate.net/widgets/latest/float.js" defer></script>
Expand Down

0 comments on commit e2b04d5

Please sign in to comment.