Commit 33a63d8a authored by  JosephK's avatar JosephK

Alert for forbidden folders

parent 52874f24
......@@ -133,6 +133,22 @@ jQuery(document).ready(function () {
jQuery(lockedPlugins.join()).hide();
jQuery('[data-grav-field-name="data[twofa_enabled]"]').parent().parent().hide();
/* Forbidden folders */
var forbidden = ['git', 'cache', 'bin', 'logs', 'backup', 'tests'];
var folderFields = [
'#new-modular [name="data[title]"]',
'#new-modular [name="data[folder]"]',
'#new-page [name="data[title]"]',
'#new-page [name="data[folder]"]'
];
jQuery(folderFields.join(', ')).on('focusout', function() {
if (RegExp(`(${forbidden.join('|')})`).test(jQuery(this).val().toLowerCase())) {
alert(`Les mots ${forbidden.join(', ')} ne sont pas autorisés`);
jQuery('#new-page [name="data[folder]"], #new-page [name="data[title]"]').val('');
jQuery(this).focus();
}
});
/** CustomCSS - ThemePicker *********************************** */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment