-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
46 lines (33 loc) · 1.3 KB
/
index.js
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
// Initialize Firebase
var config = {
apiKey: "AIzaSyDIu1WuePZvI_2xUPBxItUL57nt7ay2p6I",
authDomain: "hello-993f9.firebaseapp.com",
databaseURL: "https://hello-993f9.firebaseio.com",
};
firebase.initializeApp(config);
var emailInput=document.getElementById('getemail');
var passInput=document.getElementById('getpass');
database=firebase.database().ref('/');
auth=firebase.auth();
database=firebase.database().ref('/');
function signin(){
var user={
email:emailInput.value,
password:passInput.value
};
auth.signInWithEmailAndPassword(user.email,user.password).catch(function(error){
// document.getElementById('Error').innerHTML=" <div class='alert alert-success Profile' role='alert'> <button type='button' class='close' data-dismiss='alert' aria-label='Close'> <span aria-hidden='true'>×</span> </button> <h4 class='alert-heading'>Error</h4> <hr> <p class='mb-0'>"+error.message+ '</p></div>' ;
}).then(function(usr){
console.log(usr);
localStorage.setItem('CurentUser',usr.uid);
emailInput.value='';
passInput.value='';
location='home.html';
});}
// database.child('Users').on('value',function (snap){
// var allusers=snap.val();
// console.log();
// });
function sigup(){
location='signup.html';
}