diff options
author | Dennis Eriksen <dennis.se@gmail.com> | 2013-03-20 12:43:33 +0100 |
---|---|---|
committer | Dennis Eriksen <dennis.se@gmail.com> | 2013-03-20 12:43:33 +0100 |
commit | 266767e6b31d4799b218a7dc9ffd0d6f2eca92a8 (patch) | |
tree | e3e68b3acdfb276cadcc23d0028a6c1dd3bc8f21 /public/js/form-validators/loginValidator.js | |
parent | Edited "Sign in" button - for fun (diff) | |
download | Divid-266767e6b31d4799b218a7dc9ffd0d6f2eca92a8.tar.gz |
login screen
Diffstat (limited to 'public/js/form-validators/loginValidator.js')
-rw-r--r-- | public/js/form-validators/loginValidator.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/public/js/form-validators/loginValidator.js b/public/js/form-validators/loginValidator.js new file mode 100644 index 0000000..066e822 --- /dev/null +++ b/public/js/form-validators/loginValidator.js @@ -0,0 +1,29 @@ + +function LoginValidator(){ + +// bind a simple alert window to this controller to display any errors // + + this.loginErrors = $('.modal-alert'); + this.loginErrors.modal({ show : false, keyboard : true, backdrop : true }); + + this.showLoginError = function(t, m) + { + $('.modal-alert .modal-header h3').text(t); + $('.modal-alert .modal-body p').text(m); + this.loginErrors.modal('show'); + } + +} + +LoginValidator.prototype.validateForm = function() +{ + if ($('#user-tf').val() == ''){ + this.showLoginError('Whoops!', 'Please enter a valid username'); + return false; + } else if ($('#pass-tf').val() == ''){ + this.showLoginError('Whoops!', 'Please enter a valid password'); + return false; + } else{ + return true; + } +}
\ No newline at end of file |