From 2c03a82cecd99b72fb6a4d010cd17ae9493817ab Mon Sep 17 00:00:00 2001 From: Kumar Priyansh Date: Fri, 31 May 2019 17:12:09 +0700 Subject: Updated Login JS --- shared/Login.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/shared/Login.js b/shared/Login.js index 184fb64..6015ee5 100644 --- a/shared/Login.js +++ b/shared/Login.js @@ -1,15 +1,25 @@ $(document).ready(function(){ + function showAlert(message) { + // Get the snackbar DIV + var x = document.getElementById("snackbar"); + $('#snackbar').text(message) + // Add the "show" class to DIV + x.className = "show"; + + // After 3 seconds, remove the show class from DIV + setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000); + } $('#login').click(function(){ var email = $("#email").val() var password = $("#password").val() if(email === '' || password === '') { - alert('Please fill in all the fields') + showAlert('Please fill in all the fields') } else { firebase.auth().signInWithEmailAndPassword(email, password).catch(function(error) { // Handle Errors here. var errorCode = error.code; var errorMessage = error.message; - alert(errorMessage) + showAlert(errorMessage) // ... }); } -- cgit v1.2.3