Use third-party library to validate email at client side

This commit is contained in:
Dmitriy Simushev 2015-03-17 09:58:25 +00:00
parent 833d2a9096
commit 4332d9c205
3 changed files with 27 additions and 3 deletions

23
src/mibew/js/libs/validator.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -16,7 +16,7 @@
* limitations under the License.
*/
(function(Mibew, $, _, vex){
(function(Mibew, $, _, vex, validator){
/**
* @namespace Holds utility functions
@ -69,7 +69,7 @@
* @returns {Boolean} true if address is valid and false otherwise
*/
Mibew.Utils.checkEmail = function(email) {
return /^(([^<>()[\]\\.,;:\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,}))$/.test(email);
return validator.isEmail(email);
}
/**
@ -174,4 +174,4 @@
});
}
})(Mibew, jQuery, _, vex);
})(Mibew, jQuery, _, vex, validator);

View File

@ -265,6 +265,7 @@ abstract class AbstractController implements
'js/libs/backbone.marionette.min.js',
'js/libs/handlebars.min.js',
'js/libs/vex.combined.min.js',
'js/libs/validator.min.js',
// Client side templates
$this->getStyle()->getFilesPath() . '/templates_compiled/client_side/templates.js',
// Default client side application files