-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsignup.js
More file actions
30 lines (27 loc) · 965 Bytes
/
signup.js
File metadata and controls
30 lines (27 loc) · 965 Bytes
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
let form = document.querySelector('#form');
var firebaseConfig = {
apiKey: "AIzaSyBFkmspKoi-RDOMZfL-k9__70YIaS7vLn0",
authDomain: "notedemo-a1e15.firebaseapp.com",
projectId: "notedemo-a1e15",
storageBucket: "notedemo-a1e15.appspot.com",
messagingSenderId: "641128485554",
appId: "1:641128485554:web:db3794ada96d08b1ea2fab"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
firebase.analytics();
const auth = firebase.auth();
form.addEventListener('submit', function (e) {
e.preventDefault();
let email = form.elements.email.value;
let password = form.elements.password.value;
auth.createUserWithEmailAndPassword(email, password)
.then(cred => {
form.reset();
window.alert("Successfully Registered");
window.location.href = "index.html";
})
.catch(err => {
alert(err.message);
})
});