diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2016-05-31 08:15:33 -0400 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2016-05-31 08:15:33 -0400 |
commit | c5deb333db40e4e527f98edb93b41d1b66cfec5f (patch) | |
tree | 8585da3f41551592c23e4fb54c514a4c069ee957 /webapp/components/user_settings | |
parent | 64cce071a9ae28444e95b6389b229d80f20acf68 (diff) | |
download | chat-c5deb333db40e4e527f98edb93b41d1b66cfec5f.tar.gz chat-c5deb333db40e4e527f98edb93b41d1b66cfec5f.tar.bz2 chat-c5deb333db40e4e527f98edb93b41d1b66cfec5f.zip |
Added validation to make sure theme entries are colours (#3107)
* Added validation to make sure theme entries are colours
* Added serverside validation for theme
Diffstat (limited to 'webapp/components/user_settings')
-rw-r--r-- | webapp/components/user_settings/custom_theme_chooser.jsx | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/webapp/components/user_settings/custom_theme_chooser.jsx b/webapp/components/user_settings/custom_theme_chooser.jsx index e77ea1d30..958f30c7b 100644 --- a/webapp/components/user_settings/custom_theme_chooser.jsx +++ b/webapp/components/user_settings/custom_theme_chooser.jsx @@ -3,6 +3,7 @@ import $ from 'jquery'; import Constants from 'utils/constants.jsx'; +import * as Utils from 'utils/utils.jsx'; import 'bootstrap-colorpicker'; import {Popover, OverlayTrigger} from 'react-bootstrap'; @@ -143,13 +144,17 @@ class CustomThemeChooser extends React.Component { return; } + // theme vectors are currently represented as a number of hex color codes followed by the code theme + const colors = text.split(','); const theme = {type: 'custom'}; let index = 0; Constants.THEME_ELEMENTS.forEach((element) => { if (index < colors.length - 1) { - theme[element.id] = colors[index]; + if (Utils.isHexColor(colors[index])) { + theme[element.id] = colors[index]; + } } index++; }); |