-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐞[bug]:Signup with google isn't working
issue #427
- Loading branch information
1 parent
db6c481
commit d35941d
Showing
3 changed files
with
102 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<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"> | ||
<title>RAPIDOC</title> | ||
<link rel="icon" type="image/x-icon" href="log/favicon.ico"> | ||
<link href="https://cdn.lineicons.com/4.0/lineicons.css" rel="stylesheet" /> | ||
<link rel="stylesheet" href="log/login.css"> | ||
</head> | ||
<body> | ||
<div class="container" id="container"> | ||
<div class="form-container login-container"> | ||
<form action="#"> | ||
<h1>Signup Completed Successfully!</h1> | ||
<button class="ghost" style="color: black;"><a href="index.html">Back to Home | ||
<i class="lni lni-arrow-right register" style="rotate: 180deg;"></i></a> | ||
</button> | ||
</form> | ||
</div> | ||
|
||
<div class="overlay-container"> | ||
<div class="overlay"> | ||
|
||
</div> | ||
</div> | ||
|
||
</div> | ||
|
||
<script src="log/script.js"></script> | ||
|
||
</body> | ||
</html> |
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,63 @@ | ||
import { initializeApp } from "https://www.gstatic.com/firebasejs/10.11.1/firebase-app.js"; | ||
import { getAuth, GoogleAuthProvider, signInWithPopup } from "https://www.gstatic.com/firebasejs/10.11.1/firebase-auth.js"; | ||
|
||
const firebaseConfig = { | ||
apiKey: "AIzaSyDx_FcoL3XJryt6BInhOaDsMKiSmxzrYBI", | ||
authDomain: "fir-7f3dd.firebaseapp.com", | ||
projectId: "fir-7f3dd", | ||
storageBucket: "fir-7f3dd.appspot.com", | ||
messagingSenderId: "467011865433", | ||
appId: "1:467011865433:web:e23be9d0cc3496bb961a48" | ||
}; | ||
|
||
const app = initializeApp(firebaseConfig); | ||
const auth = getAuth(app); | ||
auth.languageCode = 'en'; | ||
|
||
const provider = new GoogleAuthProvider(); | ||
|
||
document.getElementById("google").addEventListener("click", function() { | ||
signInWithPopup(auth, provider) | ||
.then((result) => { | ||
const credential = GoogleAuthProvider.credentialFromResult(result); | ||
const user = result.user; | ||
console.log(user); | ||
window.location.href = "/signedup.html"; | ||
}).catch((error) => { | ||
console.error("Error during Google sign-in:", error); | ||
}); | ||
}); | ||
|
||
document.getElementById("signup-form").addEventListener("submit", function(event) { | ||
event.preventDefault(); // Prevent form from submitting the default way | ||
const name = document.getElementById("name").value; | ||
const email = document.getElementById("email").value; | ||
const password = document.getElementById("password").value; | ||
|
||
if (validateForm(name, email, password)) { | ||
// Simulate a successful registration (Replace with actual Firebase sign-up logic) | ||
console.log("Form submitted with:", { name, email, password }); | ||
window.location.href = "/signed.html"; | ||
} | ||
}); | ||
|
||
function validateForm(name, email, password) { | ||
if (name === "" || email === "" || password === "") { | ||
alert("All fields are required!"); | ||
return false; | ||
} | ||
if (!validateEmail(email)) { | ||
alert("Please enter a valid email address."); | ||
return false; | ||
} | ||
if (password.length < 6) { | ||
alert("Password must be at least 6 characters long."); | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
function validateEmail(email) { | ||
const re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; | ||
return re.test(email); | ||
} |