-
Notifications
You must be signed in to change notification settings - Fork 0
/
sscv.txt
31 lines (30 loc) · 975 Bytes
/
sscv.txt
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
<script>
var database = firebase.database();
</script>
<script>
document.querySelector('#signin').addEventListener('click', function(e) {
e.preventDefault();
e.stopPropagation();
var email = document.querySelector('#email').value;
var password = document.querySelector('#password').value
var credential = firebase.auth.EmailAuthProvider.credential(email, password);
var auth = firebase.auth();
var currentUser = auth.currentUser;
var uid = currentUser.uid;
console.log(uid);
writeUserData(uid,email);
// window.location = "/index.html";
firebase.auth().signInWithEmailAndPassword(email, password).catch(function(error) {
// Handle Errors here.
});
console.log(uid);
console.log(uid);
});
function writeUserData( uid ,email ) {
console.log(uid);
database.ref('users/' + uid).set({
username: uid,
email: email
});
}
</script>