-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfirebase-signup.html
38 lines (33 loc) · 1.46 KB
/
firebase-signup.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<script src="https://www.gstatic.com/firebasejs/7.16.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.16.0/firebase-analytics.js"></script>
<script>
// Import the functions you need from the SDKs you need
import { initializeApp } from "firebase/app";
import { getAnalytics } from "firebase/analytics";
// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
apiKey: "AIzaSyAol_fATQ8OuBQRALAo_o7pFSE_01-_W3g",
authDomain: "e-commerce-social-media-webapp.firebaseapp.com",
projectId: "e-commerce-social-media-webapp",
storageBucket: "e-commerce-social-media-webapp.appspot.com",
messagingSenderId: "894487759666",
appId: "1:894487759666:web:806b8c0b904b954a4a252b",
measurementId: "G-18THWBJCKC"
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const analytics = getAnalytics(app);
// Signup button click event handler
const signUpButton = document.getElementById("signUpButton");
signUpButton.addEventListener("click", (e) => {
// Get the email and password from the form
const email = document.getElementById("email").value;
const password = document.getElementById("password").value;
// Create a new user with the email and password
firebase.auth().createUserWithEmailAndPassword(email, password).then((user) => {
// The user was created successfully, redirect to login page
window.location.href = "login.html";
});
});
</script>