commit 2f0aeb517c8360f8d719fdf711aa40f545ac92a5
parent 32f23b86f1632231eb486ed8434cec36efbb52c7
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Fri, 20 Jan 2023 00:34:22 -0800
add validation
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pkg/web/handlers/handlers.go b/pkg/web/handlers/handlers.go
@@ -2933,7 +2933,7 @@ func changeSettingsForm(c echo.Context, data settingsChatData) error {
data.NotifyNewMessage = utils.DoParseBool(c.Request().PostFormValue("notify_new_message"))
data.NotifyTagged = utils.DoParseBool(c.Request().PostFormValue("notify_tagged"))
data.NotifyPmmed = utils.DoParseBool(c.Request().PostFormValue("notify_pmmed"))
- data.Theme = utils.DoParseInt64(c.Request().PostFormValue("theme"))
+ data.Theme = utils.Clamp(utils.DoParseInt64(c.Request().PostFormValue("theme")), 0, 2)
data.NotifyChessGames = utils.DoParseBool(c.Request().PostFormValue("notify_chess_games"))
data.NotifyChessMove = utils.DoParseBool(c.Request().PostFormValue("notify_chess_move"))
//data.NotifyNewMessageSound = utils.DoParseInt64(c.Request().PostFormValue("notify_new_message_sound"))