aboutsummaryrefslogtreecommitdiff
path: root/shared/Login.js
diff options
context:
space:
mode:
Diffstat (limited to 'shared/Login.js')
-rw-r--r--shared/Login.js14
1 files 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)
// ...
});
}