Added validation to make sure theme entries are colours (#3107)
* Added validation to make sure theme entries are colours * Added serverside validation for theme
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
64cce071a9
Коммит
c5deb333db
@@ -186,6 +186,21 @@ func (u *User) PreUpdate() {
|
||||
}
|
||||
u.NotifyProps["mention_keys"] = strings.Join(goodKeys, ",")
|
||||
}
|
||||
|
||||
if u.ThemeProps != nil {
|
||||
colorPattern := regexp.MustCompile(`^#[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$`)
|
||||
|
||||
// blank out any invalid theme values
|
||||
for name, value := range u.ThemeProps {
|
||||
if name == "image" || name == "type" || name == "codeTheme" {
|
||||
continue
|
||||
}
|
||||
|
||||
if !colorPattern.MatchString(value) {
|
||||
u.ThemeProps[name] = "#ffffff"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (u *User) SetDefaultNotifications() {
|
||||
|
||||
Ссылка в новой задаче
Block a user