diff --git a/assets/js/vex.js b/assets/js/vex.js new file mode 100644 index 0000000..f0cffea --- /dev/null +++ b/assets/js/vex.js @@ -0,0 +1,39 @@ +vex.defaultOptions.className = 'vex-theme-os'; + +// Login button from navbar +$('.login').click(function(){ + vex.dialog.open({ + showCloseButton: true, + message: 'Enter your username and password:', + input: '' + + '' + + '' + + '' + + '', + buttons: [ + $.extend({}, vex.dialog.buttons.YES, { text: 'Login' }), + $.extend({}, vex.dialog.buttons.NO, { text: 'Cancel' }) + ], + callback: function (data) { + if (data.username == undefined){ + }else if (data.password == undefined){ + }else if (data.register == true){ + // ? + }else{ + // AJAX request to log in + $.post("../../login.php", data, function(datam){ + $("#message").hide().html(datam).fadeIn("fast"); + if($('#error').length){ + $('#short-button').removeClass('btn-primary'); + $('#short-button').removeClass('btn-success'); + $('#short-button').addClass('btn-danger'); + }else if($('#success').length){ + $('#short-button').removeClass('btn-primary'); + $('#short-button').removeClass('btn-danger'); + $('#short-button').addClass('btn-success'); + } + }); + } + } + }); +}); \ No newline at end of file diff --git a/index.php b/index.php index 56cba14..d83ca5a 100644 --- a/index.php +++ b/index.php @@ -50,6 +50,11 @@ + + + + + @@ -82,8 +87,7 @@ -
-
+
@@ -101,6 +105,11 @@ + + + + +