commit a2b13800beb3d28d3107ee703174736ef14f36bf
parent 850b4bc8db66bfe7128ad37d11998f002b9f88b0
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Wed, 11 Jan 2023 12:04:43 -0800
cleanup
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/pkg/web/handlers/chat.go b/pkg/web/handlers/chat.go
@@ -43,8 +43,7 @@ func chatHandler(c echo.Context, redRoom bool) error {
data.CaptchaID, data.CaptchaImg = captcha.New()
}
- roomName := getRoomName(c)
- room, err := database.GetChatRoomByName(roomName)
+ room, err := database.GetChatRoomByName(getRoomName(c))
if err != nil {
return c.Redirect(http.StatusFound, "/")
}
@@ -86,6 +85,8 @@ func chatHandler(c echo.Context, redRoom bool) error {
return c.Redirect(http.StatusFound, c.Request().Referer())
}
+ // If you don't have access to the room (room is protected and user is nil or no cookie with the password)
+ // We display the page to enter room password.
if !room.HasAccess(c) {
return c.Render(http.StatusOK, "chat-password", data)
}