protect against domain change attacks, word wrap for editor

This commit is contained in:
Kyle Drake 2013-07-28 18:34:06 -04:00
parent 4994de0927
commit bf7627f7f9
2 changed files with 6 additions and 1 deletions

View file

@ -100,8 +100,12 @@ class Site < Sequel::Model
if !(values[:domain] =~ /^[a-zA-Z0-9]+\.[a-zA-Z0-9]+$/i)
errors.add :domain, "Domain provided is not valid. Must take the form of domain.com"
end
end
site = Site[domain: values[:domain]]
if !site.nil? && site.id != self.id
errors.add :domain, "Domain provided is already being used by another site, please choose another."
end
end
end
def file_path

View file

@ -122,6 +122,7 @@ css:
setTheme();
editor.getSession().setMode("ace/mode/html");
editor.getSession().setTabSize(2);
editor.getSession().setUseWrapMode(true);
editor.setFontSize(14);
editor.setShowPrintMargin(false);
});