Validate color fields on appearance page

This commit is contained in:
Toby Zerner 2015-08-04 10:38:49 +09:30
parent 83e8503df1
commit afe031f269

View File

@ -69,6 +69,13 @@ export default class AppearancePage extends Component {
onsubmit(e) {
e.preventDefault();
const hex = /^#[0-9a-f]{3}([0-9a-f]{3})?$/i;
if (!hex.test(this.primaryColor()) || !hex.test(this.secondaryColor())) {
alert('Please enter a hexadecimal color code.');
return;
}
this.loading = true;
saveConfig({