Skip to content

Commit

Permalink
Merge pull request #660 from dohinaf/merge
Browse files Browse the repository at this point in the history
Merge#443
  • Loading branch information
dohinafs authored Oct 19, 2024
2 parents 01c3d0c + 5eb83e6 commit 4385bb6
Show file tree
Hide file tree
Showing 12 changed files with 614 additions and 110 deletions.
Binary file added bg2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added facebook.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added google.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
78 changes: 73 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -420,13 +420,27 @@ <h2>Scoop Up the Savings!</h2>
<input type="name" id="name" placeholder="Enter your Name">
<input type="email" id="email" placeholder="Enter your Email" required>
<input type="password" id="password" placeholder="Enter your Password" required>

<button type="submit" class="signup-btn">SIGN UP</button>
</form>
<a href="#" class="no-thanks">No thanks</a>
<p class="terms">By signing up, you agree to our <a href="#">Terms of Service</a> and <a href="#">Privacy Policy</a>.</p>
</div>
</div>
</form>
<a href="#" class="no-thanks">No thanks</a>
<p class="terms">By signing up, you agree to our <a href="#">Terms of Service</a> and <a href="#">Privacy Policy</a>.</p>
</div>
</div>
</div>

<script>
// Handle form submission for the pop-up sign-up form
document.getElementById('emailForm').addEventListener('submit', function(event) {
event.preventDefault(); // Prevent default form submission

// Perform any sign-up logic here, such as email validation or server requests

// Redirect to profile.html after sign-up
window.location.href = 'profile.html'; // Redirect user to the profile page
});
</script>

<!-- Pop-up for Discount and Sign up Ends here -->

<!-- Script for pop up discount Starts Here -->
Expand Down Expand Up @@ -513,6 +527,60 @@ <h3 data-aos="fade-left" data-aos-duration="1200" data-aos-delay="200">What Make
</section>


<!-- Login Modal -->
<div id="login-modal" class="modal login-container">
<div class="login-card">
<div class="login-image">
<img src="https://static.vecteezy.com/system/resources/thumbnails/044/570/761/small_2x/assortment-of-colorful-ice-cream-scoops-in-waffle-cones-with-fresh-fruits-on-a-transparent-background-png.png" alt="Ice Cream" />
</div>

<div class="modal-content login-form">
<span class="close-btn" id="close-login">&times;</span>
<h2>Login to Your Account</h2>
<form>
<h3>Email :-</h3>
<br>
<input type="email" placeholder="Email" required>

<h3>Password :-</h3>
<br>
<input type="password" placeholder="Password" required class="inputFields">
<button type="submit">Login</button>

<p>Don't have an account? <a href="#sign-modal">Sign up</a></p>



</form>
</div>
</div>
</div>

<!-- Signup Modal -->
<div id="signup-modal" class="modal">
<div class="modal-content">
<span class="close-btn" id="close-signup">&times;</span>
<h2>Sign Up</h2>
<form id="signup-form">
<input type="text" placeholder="Full Name" required>
<input type="email" placeholder="Email" required>
<input type="password" class="pass-btn" placeholder="Password" required>
<button type="submit" class="sign-btn">Sign Up</button>
</form>
</div>
</div>


<script>
document.getElementById('signup-form').addEventListener('submit', function(event) {
event.preventDefault(); // Prevent default form submission

// Perform validation or backend signup request here
// If signup is successful, redirect to profile.html

window.location.href = 'profile.html'; // Redirect to profile page
});
</script>

<!-- About Section Ends Here -->

Expand Down
Binary file added instagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 3 additions & 26 deletions login/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,20 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login Page</title>
<link rel="stylesheet" href="../preloaderStyle.css">
<link rel="stylesheet" href="login.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
</head>
<body>
<!-- preloader -->
<div id="preloader">
<div class="wrapper">
<div class="box-wrap">
<div class="box one"></div>
<div class="box two"></div>
<div class="box three"></div>
<div class="box four"></div>
<div class="box five"></div>
<div class="box six"></div>
</div>
</div>
</div>
<div class="login-container">
<div id="login-box" class="login-box">
<h2>Welcome Back!</h2>
<form action="#" class="login-form">
<form class="login-form">
<div class="input-group">
<i class="fas fa-envelope"></i>
<input type="email" required>
<input type="email" name="email" required>
<label>Email</label>
</div>
<div class="input-group">
<i class="fas fa-lock"></i>
<input type="password" id="password" required>
<span class="toggle-password" onclick="togglePasswordVisibility()">
<i class="fas fa-eye" id="eye-icon"></i>
</span>
<input type="password" name="password" required>
<label>Password</label>
</div>
<button class="login-btn" type="submit">Login</button>
Expand All @@ -47,10 +28,6 @@ <h2>Welcome Back!</h2>
</form>
</div>
</div>
<script src="../preloader.js"></script>
<script src="login.js"></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>
</body>
</html>
74 changes: 39 additions & 35 deletions login/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,43 +46,47 @@ if (loginCard) {
if (signupCard) {
addHoverEffect(signupCard);
}
document.querySelector(".login-form").addEventListener("submit", function (e) {
e.preventDefault(); // Prevent form submission

const email = document.querySelector('.login-form input[type="email"]').value;
const password = document.querySelector(
'.login-form input[type="password"]'
).value;

// Retrieve data from local storage
const existingUsersData = localStorage.getItem("users");

if (existingUsersData) {
const usersArray = JSON.parse(existingUsersData); // Parse the JSON string back to an array of objects
let userFound = false; // Flag to track if user is found

// Loop through users and check if any match the input credentials
usersArray.forEach((userData) => {
if (email === userData.email && password === userData.password) {
userFound = true;
alert("Glad you are back for another treat!");
// Redirect to index.html
window.location.assign("../index.html");
}
});

if (!userFound) {
// If no matching user is found
alert("Invalid email or password!");
}
} else {
// If no users found in local storage
alert("No user found. Please sign up first.");
window.location.assign("../signup/signup.html");
}
document.addEventListener('DOMContentLoaded', () => {
const loginForm = document.querySelector('.login-form');

loginForm.addEventListener('submit', function (e) {
e.preventDefault(); // Prevent default form submission

const email = document.querySelector('input[name="email"]').value;
const password = document.querySelector('input[name="password"]').value;

// Retrieve data from local storage
const existingUsersData = localStorage.getItem("users");

if (existingUsersData) {
const usersArray = JSON.parse(existingUsersData);
let userFound = false;

// Check if user exists
for (const userData of usersArray) {
if (email === userData.email && password === userData.password) {
userFound = true;
alert("Glad you are back for another treat!");
// Redirect to profile.html after a short delay
setTimeout(() => {
window.location.href = '../profile.html'; // Redirect to the profile page
}, 500); // 500 milliseconds delay
break; // Exit the loop once found
}
}

if (!userFound) {
alert("Invalid email or password!"); // Show alert only once
}
} else {
alert("No user found. Please sign up first.");
window.location.href = "../signup/signup.html"; // Redirect to signup page
}

// Clear the form fields
document.querySelector(".login-form").reset();
// Clear the form fields after processing
loginForm.reset();
});
});


Expand Down
Loading

0 comments on commit 4385bb6

Please sign in to comment.