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

login page #494

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
Binary file added 1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions css/sec4.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* .footer {
.footer {
background-size: cover;
background-position: center;
background-attachment: fixed;
Expand Down Expand Up @@ -70,5 +70,5 @@
justify-content: space-between;
width: 60%;
margin-top: 10px;
} */
}

8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
<div class="navs2">
<!-- <img src="img/final logo 1.png" alt="" /> -->
<img src="assests/moon.png" alt="image" id="themeImg">
<button onclick="click" id="loginButton" class="button_nav txtColor hello" >Log
In</button>
<button id="loginButton" class="button_nav txtColor hello" ><a href="login.html">
LogIn</a></button>
<button id="signup" class="button_nav txtColor">Sign Up</button>
<button onclick="click" id="Calender" class="button_nav txtColor1 hello">Calendar</button>
</div>
Expand Down Expand Up @@ -74,7 +74,7 @@
</div>
</div>

<div class="overlay" id="overlay">
<!-- <div class="overlay" id="overlay">
<div class="popup">
<div class="option">
<img src="email_icon.png" alt="Email">
Expand All @@ -93,7 +93,7 @@
<div>Sign in with Yahoo</div>
</div>
</div>
</div>
</div> -->

<!-- Sec-1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<div class="sec1">
Expand Down
209 changes: 209 additions & 0 deletions login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
<!DOCTYPE html>
<html lang="pt-BR">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://www.gstatic.com/firebasejs/9.0.0/firebase-app-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/9.0.0/firebase-auth-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/9.0.0/firebase-database-compat.js"></script>
<link rel="stylesheet" href="login1.css">
<link href='https://unpkg.com/[email protected]/css/boxicons.min.css' rel='stylesheet'>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"
integrity="sha512-iecdLmaskl7CVkqkXNQ/ZH/XLlvWZOJyj7Yy7tcenmpD1ypASozpmT/E0iPtmFIB46ZmdtAc9eNBvH0H/ZpiBw=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="https://unpkg.com/aos@next/dist/aos.css" />
<link
href="https://fonts.googleapis.com/css2?family=Fuggles&family=Mooli&family=Oswald:wght@600&family=Roboto:wght@100;300&display=swap"
rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Baloo+Bhai|Bree+Serif&display=swap" rel="stylesheet">
<link rel="shortcut icon" href="./img/favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="./chatBot/style.css">
<script src="https://kit.fontawesome.com/d1c523657e.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="css/navbar.css" />
<link rel="stylesheet" href="css/sec1.css" />
<link rel="stylesheet" href="css/sec2.css" />
<link rel="stylesheet" href="css/sec3.css" />
<link rel="stylesheet" href="css/sec4.css" />
<!-- material -->
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,400,0,0" />
<link rel="stylesheet" href="css/desktop_9.css">

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css"
integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="../Css-files/scroll-top-button.css">
<link rel="stylesheet" href="../Css-files/content.css">
<script src="../hamburger.js"></script>
<link rel="stylesheet" href="https://unpkg.com/aos@next/dist/aos.css" />
<title>Login</title>
</head>

<body>
<div class="navbar" id="navbar">
<div class="navs1">
<a href="index.html"><img src="img/final logo 1.png" alt="" /></a>
<div class="span1"><a href="index.html">Blogzen</a></div>
<!-- <div class="span2"><a href="index.html">zen</a></div> -->
</div>

<div class="navs2">
<!-- <img src="img/final logo 1.png" alt="" /> -->
<img src="assests/moon.png" alt="image" id="themeImg">
<button id="loginButton" class="button_nav txtColor hello" ><a href="login.html">
LogIn</a></button>
<button id="signup" class="button_nav txtColor">Sign Up</button>
<button onclick="click" id="Calender" class="button_nav txtColor1 hello">Calendar</button>
</div>
</div>

<section>
<div class="main-login">
<div class="left-login" data-aos="zoom-out-left" data-aos-duration="1000" data-aos-offset="170" data-aos-easing="ease-in-out">
<h1><b>Login Here</b></h1>
<img src="1.png" class="left-login-image" alt="food">
</div>
<div class="right-login">
<div class="card-login" data-aos="zoom-out-right" data-aos-duration="1000" data-aos-offset="170" data-aos-easing="ease-in-out">
<button class="close-btn">&times;</button>
<h1>LOGIN</h1>
<br>
<div class="textfield">
<label for="email">Email</label>
<input type="email" name="email" id="email" placeholder="Enter Email">
</div>
<div class="textfield">
<label for="username">Username</label>
<input type="text" name="Username" id="username" placeholder="Username">
</div>
<div class="textfield">
<label for="password">Password</label>
<input type="password" id="password" name="password" placeholder="Enter Password">
<span id="login-hide">
<i class='icon bx bxs-hide' style="font-size: 27px;"></i>
</span>
</div>
<button class="btn-login" onclick="validateLogin()">Login</button>
<h3>
<center>OR</center>
</h3>
<button id="google-login">Login with Google</button>
</div>
</div>
</div>
</section>
<div class="footer">
<div class="socials">
<div class="footer_titles">Follow us on our socials</div>
<div class="icons">

</div>
</div>
<div class="newsletter">
<div class="footer_titles">Subscribe to our newsletter</div>
<form id="subscriptionForm">
<input type="email" id="emailId" name="email" placeholder="Your Email" required>
<button type="submit">Subscribe</button>
</form>
<div id="subscriptionMessage" style="display: none;">You have subscribed successfully!</div>
</div>
<script src="https://unpkg.com/aos@next/dist/aos.js"></script>
<script>
AOS.init({
duration: 1000,
easing: 'ease',
once: false,
});

// Firebase configuration
const firebaseConfig = {
//Add your Config File
};

// Initialize Firebase
firebase.initializeApp(firebaseConfig);
const database = firebase.database();
const auth = firebase.auth();

// Password visibility toggle
const passwordInput = document.getElementById("password");
const hideLogo = document.getElementById("login-hide");
hideLogo.addEventListener("click", function () {
const passwordField = this.querySelector("i");
if (passwordInput.getAttribute("type") == "text") {
passwordInput.setAttribute("type", "password");
passwordField.classList.replace("bxs-show", "bxs-hide");
} else {
passwordInput.setAttribute("type", "text");
passwordField.classList.replace("bxs-hide", "bxs-show");
}
});

// Close button redirect
const closeBtn = document.querySelector('.close-btn');
closeBtn.addEventListener('click', function () {
window.location.href = '../index.html';
});

// Login validation
function validateLogin() {
const email = document.getElementById("email").value;
const username = document.getElementById("username").value;
const password = document.getElementById("password").value;

if (email === "") {
alert("Please Enter Email");
} else if (username === "") {
alert("Please Enter Username");
} else if (password === "") {
alert("Please Enter Password");
} else {
auth.signInWithEmailAndPassword(email, password)
.then((userCredential) => {
const user = userCredential.user;
database.ref('users/' + user.uid).set({
username: username,
email: email
}).then(() => {
alert("Login successful");
window.location.href = '../index.html';
}).catch((error) => {
alert("Data could not be saved: " + error.message);
});
})
.catch((error) => {
alert("Login failed: " + error.message);
});
}
}
// Google Sign-In
document.getElementById('google-login').addEventListener('click', () => {
const provider = new firebase.auth.GoogleAuthProvider();
auth.signInWithPopup(provider)
.then((result) => {
const user = result.user;

// Save user info to Realtime Database if new user
if (result.additionalUserInfo.isNewUser) {
return database.ref('users/' + user.uid).set({
name: user.displayName,
email: user.email,
username: user.email.split('@')[0]
});
}
})
.then(() => {
alert('Logged in with Google!');
window.location.href = '../index.html'; // Redirect to homepage or dashboard
})
.catch((error) => {
console.error('Error logging in with Google:', error);
alert(error.message);
});
});
</script>
</body>

</html>
Loading
Loading