shareyourfingerprint/res/js/jq-idealforms-extend-validate.js

26 lines
717 B
JavaScript

$.extend($.idealforms.rules, {
fingerprint : /^([ABCDEF0-9]{4}\ ){5}(\ )?([ABCDEF0-9]{4}\ ){4}[ABCDEF0-9]{4}$/,
multiple2 : function(input, value) {
return Number(value) % 2 == 0;
},
emails : function(input, value) {
areEmails = true;
emails = value.split(",");
console.log(emails);
for ( var e = 0 in emails) {
if (!/^[^@]+@[^@]+\..{2,6}$/.test(emails[e])) {
areEmails = false;
break;
}
}
return areEmails;
},
});
$.extend($.idealforms.errors,{
fingerprint : 'Must be a valid gpg fingerprint (es. AB98 AF02 852A 24EA A298 AF02 852A 23CA AB98 AA02 or gpg -K --fingerprint format)',
multiple2 : 'Must be a multiple of 2',
emails : 'Must be a valid email(s) comma separated',
});