AdminValidators.js revision 09fad487211d9b17d4df263ed3b17cd4a6bcc55c
/**
* Created by forgerock on 8/7/14.
*/
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2014 ForgeRock AS. All rights reserved.
*/
/*global define, $, _ */
], function(constants, eventManager) {
var obj = {
"changed": {
"name": "Changed field",
"dependencies": [
],
callback();
}
},
"whitespace": {
"name": "No whitespace allowed.",
"dependencies": [
],
callback(["Cannot contain spaces"]);
return;
}
callback(["Required"]);
return;
}
callback();
}
},
"certificate": {
"name": "Valid Certificate String",
"dependencies": [
],
if (v.length && !v.match(/\-\-\-\-\-BEGIN CERTIFICATE\-\-\-\-\-\n[^\-]*\n\-\-\-\-\-END CERTIFICATE\-\-\-\-\-\s*$/)) {
callback(["Invalid Certificate"]);
return;
}
callback();
}
},
"bothRequired": {
"name": "Two Required Fields",
"dependencies": [
],
callback([$.t("templates.scriptEditor.bothRequired")]);
return;
}
callback([$.t("templates.scriptEditor.bothRequired")]);
return;
}
callback([$.t("templates.scriptEditor.bothRequired")]);
return;
}
}
callback();
}
}, "spaceCheck": {
"name": "Whitespace validator",
"dependencies": [
],
if (!v || v === "") {
callback([$.t("common.form.validation.required")]);
return;
}
callback([$.t("common.form.validation.spaceNotAllowed")]);
return;
}
callback();
}
}
};
return obj;
});