[REFACTOR] refs #6229 - extract validation to a method

this enables plugins (e.g. katello) to override the validation when
requried.
fixes #6319 - precompile dashboard.js