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/emailValidator.js | |
parent | Edited "Sign in" button - for fun (diff) | |
download | Divid-266767e6b31d4799b218a7dc9ffd0d6f2eca92a8.tar.gz |
login screen
Diffstat (limited to 'public/js/form-validators/emailValidator.js')
-rw-r--r-- | public/js/form-validators/emailValidator.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/public/js/form-validators/emailValidator.js b/public/js/form-validators/emailValidator.js new file mode 100644 index 0000000..5a87c04 --- /dev/null +++ b/public/js/form-validators/emailValidator.js @@ -0,0 +1,39 @@ + +function EmailValidator(){ + +// bind this to _local for anonymous functions // + + var _local = this; + +// modal window to allow users to request credentials by email // + _local.retrievePassword = $('#get-credentials'); + _local.retrievePassword.modal({ show : false, keyboard : true, backdrop : true }); + _local.retrievePasswordAlert = $('#get-credentials .alert'); + _local.retrievePassword.on('show', function(){ $('#get-credentials-form').resetForm(); _local.retrievePasswordAlert.hide();}); + +} + +EmailValidator.prototype.validateEmail = function(e) +{ + var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; + return re.test(e); +} + +EmailValidator.prototype.showEmailAlert = function(m) +{ + this.retrievePasswordAlert.attr('class', 'alert alert-error'); + this.retrievePasswordAlert.html(m); + this.retrievePasswordAlert.show(); +} + +EmailValidator.prototype.hideEmailAlert = function() +{ + this.retrievePasswordAlert.hide(); +} + +EmailValidator.prototype.showEmailSuccess = function(m) +{ + this.retrievePasswordAlert.attr('class', 'alert alert-success'); + this.retrievePasswordAlert.html(m); + this.retrievePasswordAlert.fadeIn(500); +}
\ No newline at end of file |