-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #494 from Its-your-rj/main
login page
- Loading branch information
Showing
5 changed files
with
409 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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">×</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> |
Oops, something went wrong.