Created
September 1, 2018 01:21
-
-
Save jason-dark/d350958f60858cde03d6731c8679f7fc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- logout function --> | |
<script> | |
logoutLink.addEventListener('click', logout); | |
function logout() { | |
firebase.auth().signOut(); | |
} | |
</script> | |
<!-- login function --> | |
<script> | |
loginButton.addEventListener('click', login); | |
function login() { | |
loginButton.style.display = 'none'; | |
loginError.style.display = 'none'; | |
var email = loginEmail.value; | |
var password = loginPassword.value; | |
firebase.auth().signInWithEmailAndPassword(email, password) | |
.then(function () { | |
window.location.replace('./private'); | |
}) | |
.catch(function (error) { | |
var errorCode = error.code; | |
var errorMessage = error.message; | |
console.log('Error code: ' + errorCode); | |
console.log('Error message: ' + errorMessage); | |
loginButton.style.display = 'block'; | |
loginError.innerText = errorMessage; | |
loginError.style.display = 'block'; | |
}); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment