Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forgot Password shows incorrect email FORMAT #800

Merged
merged 3 commits into from
Oct 31, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 31 additions & 53 deletions Html-files/forgot-pass.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,20 @@
</head>
<body>
<div class="circle-container">
<!-- Circles for background animation -->
<div class="circle" style="background-color: rgb(255, 181, 107) !important; left: 504px; top: 59px; scale: 1;"></div>
<div class="circle" style="background-color: rgb(253, 175, 105) !important; left: 504px; top: 59px; scale: 0.95;"></div>
<div class="circle" style="background-color: rgb(248, 157, 99) !important; left: 504px; top: 59px; scale: 0.9;"></div>
<div class="circle" style="background-color: rgb(245, 151, 97) !important; left: 504px; top: 59px; scale: 0.85;"></div>
<div class="circle" style="background-color: rgb(239, 134, 94) !important; left: 504px; top: 59px; scale: 0.8;"></div>
<div class="circle" style="background-color: rgb(236, 128, 93) !important; left: 504px; top: 59px; scale: 0.75;"></div>
<div class="circle" style="background-color: rgb(227, 110, 92) !important; left: 504px; top: 59px; scale: 0.7;"></div>
<div class="circle" style="background-color: rgb(223, 104, 92) !important; left: 504px; top: 59px; scale: 0.65;"></div>
<div class="circle" style="background-color: rgb(213, 88, 92) !important; left: 504px; top: 59px; scale: 0.6;"></div>
<div class="circle" style="background-color: rgb(209, 82, 92) !important; left: 504px; top: 59px; scale: 0.55;"></div>
<div class="circle" style="background-color: rgb(197, 65, 93) !important; left: 504px; top: 59px; scale: 0.5;"></div>
<div class="circle" style="background-color: rgb(192, 59, 93) !important; left: 504px; top: 59px; scale: 0.45;"></div>
<div class="circle" style="background-color: rgb(178, 44, 94) !important; left: 504px; top: 59px; scale: 0.4;"></div>
<div class="circle" style="background-color: rgb(172, 38, 94) !important; left: 504px; top: 59px; scale: 0.35;"></div>
<div class="circle" style="background-color: rgb(156, 21, 95) !important; left: 504px; top: 59px; scale: 0.3;"></div>
<div class="circle" style="background-color: rgb(149, 15, 95) !important; left: 504px; top: 59px; scale: 0.25;"></div>
<div class="circle" style="background-color: rgb(131, 0, 96) !important; left: 504px; top: 59px; scale: 0.2;"></div>
<div class="circle" style="background-color: rgb(124, 0, 96) !important; left: 504px; top: 59px; scale: 0.15;"></div>
<div class="circle" style="background-color: rgb(104, 0, 96) !important; left: 504px; top: 59px; scale: 0.1;"></div>
<!-- Additional circles... -->
<div class="circle" style="background-color: rgb(96, 0, 95) !important; left: 504px; top: 59px; scale: 0.05;"></div>
</div>
<div class="home-btn"><a href="../index.html" style="font-family: var(--ff-philosopher);"><b>Retro</b></a></div>
<div class="container" style="display: flex;
align-items: center;
justify-content: center;">
<div class="container" style="display: flex; align-items: center; justify-content: center;">
<div class="card-forgot">
<h1>Forgot Password</h1>
<form id="forgotPassForm">
<div class="textfield">
<label for="email" style="color: black;">Email</label>
<input type="email" id="email" name="email" placeholder="Enter your email" required>
<input type="email" id="email" name="email" placeholder="name@example.com" required>
</div>
<button type="submit" class="btn-reset">Reset Password</button>
<p id="error-message" class="error-message"></p>
Expand All @@ -50,32 +33,17 @@ <h1>Forgot Password</h1>
</div>

<script>
const coords = { x: 0, y: 0 };
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"
"#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) {
Expand All @@ -87,18 +55,15 @@ <h1>Forgot Password</h1>
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;
Expand All @@ -113,17 +78,30 @@ <h1>Forgot Password</h1>
}

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., user@example.com).';
}
});

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

const emailInput = document.getElementById('email').value;
const emailPattern = /^[^\\s@]+@[^\s@]+\\.[^\\s@]+$/;

document.getElementById('error-message').textContent = '';
const emailInputValue = emailInput.value;

if (!emailPattern.test(emailInput)) {
document.getElementById('error-message').textContent = 'Invalid email format.';
if (!validateEmail(emailInputValue)) {
errorMessage.textContent = 'The email format is invalid. Ensure it includes “@” and a domain name (e.g., user@example.com).';
} else {
window.location.assign('reset-confirmation.html');
}
Expand Down