Skip to content

Instantly share code, notes, and snippets.

@dimovdaniel
Last active December 15, 2016 19:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dimovdaniel/bc4fcee549ad7eb6ebd5f6c1d17fb9d5 to your computer and use it in GitHub Desktop.
Save dimovdaniel/bc4fcee549ad7eb6ebd5f6c1d17fb9d5 to your computer and use it in GitHub Desktop.
<script>
// Initialize Firebase
var config = {
apiKey: settings.apiKey,
authDomain: settings.authDomain,
databaseURL: settings.databaseURL,
storageBucket: settings.storageBucket,
messagingSenderId: settings.messagingSenderId
};
firebase.initializeApp(config);
$( document ).ready(function() {
$('#btnLogin').click(function(e){
if($('#username').val()=="myemail@gmail.com"){
firebase.auth().signInWithEmailAndPassword($('#username').val(), $('#password').val())
.then(
function(data) {
window.location.replace("index.php");
}
)
.catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
$('#error').html(errorMessage)
});
}else{
$('#error').html("HEY, Your are not our admin. Sorry")
}
})
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment