Skip to content

Commit

Permalink
Merge pull request #1171 from anjali5Xcode/main
Browse files Browse the repository at this point in the history
Updated login.html
  • Loading branch information
vimistify authored Nov 7, 2024
2 parents 868ab1b + 0848189 commit cf389d2
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
30 changes: 29 additions & 1 deletion login.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<div class="container">
<div class="forms-container">
<div class="signin-signup">
<form action="#" class="sign-in-form">
<form action="#" class="sign-in-form" onsubmit="return validateSignInForm()">
<h2 class="title">Sign in</h2>
<div class="input-field">
<i class="fas fa-user"></i>
Expand All @@ -76,6 +76,34 @@ <h2 class="title">Sign in</h2>
</a>
</div>
</form>
<script>
function validateSignInForm() {
const username = document.querySelector('.sign-in-form input[type="text"]').value;
const password = document.querySelector('.sign-in-form input[type="password"]').value;

// Sign-in validation logic
if (username.trim() === "") {
alert("Please enter your username.");
return false;
}

if (password.trim() === "") {
alert("Please enter your password.");
return false;
}

// Simulate successful login
alert("You have successfully logged in to the website!");

// Redirect to the home screen after a short delay
setTimeout(function() {
window.location.href = "index.html";
}, 2000); // Redirect after 2 seconds

// If all validations pass, return true to allow form submission
return false; // Prevent form submission since we are handling the redirect
};
</script>
<form action="#" class="sign-up-form"
style="background-color: #fff; padding: 20px; border-radius: 10px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);">
<h2 class="title">Sign up</h2>
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cf389d2

Please sign in to comment.