-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdata.js
More file actions
52 lines (50 loc) · 1.75 KB
/
data.js
File metadata and controls
52 lines (50 loc) · 1.75 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const firebaseConfig = {
apiKey: "AIzaSyCLduNwd2jtvvVLh0160V6Ton4HqlRRZQA",
authDomain: "girlathon-d90df.firebaseapp.com",
projectId: "girlathon-d90df",
storageBucket: "girlathon-d90df.appspot.com",
messagingSenderId: "744649727731",
appId: "1:744649727731:web:3eda38467080180f622186",
measurementId: "G-9K9JE07HCM"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
firebase.analytics();
// let's code
var datab = firebase.database().ref('data');
function UserRegister(){
var email = document.getElementById('eemail').value;
var password = document.getElementById('lpassword').value;
var phoneno = document.getElementById('phone').value;
var teamname = document.getElementById('tname').value;
firebase.auth().createUserWithEmailAndPassword(email,password).then(function(){
}).catch(function (error){
var errorcode = error.code;
var errormsg = error.message;
});
}
const auth = firebase.auth();
function SignIn(){
var email = document.getElementById('eemail').value;
var password = document.getElementById('lpassword').value;
const promise = auth.signInWithEmailAndPassword(email,password);
promise.catch( e => alert(e.msg));
window.open("https://www.google.com","_self");
}
document.getElementById('form').addEventListener('submit', (e) => {
e.preventDefault();
var userInfo = datab.push();
userInfo.set({
name: getId('fname'),
email : getId('eemail'),
password : getId('lpassword'),
phoneno : getId('phone'),
teamname : getId('tname')
});
alert("Successfully Signed Up");
console.log("sent");
document.getElementById('form').reset();
});
function getId(id){
return document.getElementById(id).value;
}