dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit a430e3f5f20a84fb3cbb3c67715fb9f906add0cf
parent 6ff0ea8b4d54b47d87a2a72a0cb3079c3e158d5f
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Tue, 13 Dec 2022 22:44:38 -0500

fix build

Diffstat:
Mpkg/web/handlers/handlers.go | 18+++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/pkg/web/handlers/handlers.go b/pkg/web/handlers/handlers.go @@ -85,7 +85,7 @@ func firstUseHandler(c echo.Context) error { config.IsFirstUse.SetFalse() - session, err := database.CreateSession(newUser.ID, c.RealIP(), c.Request().UserAgent()) + session, err := database.CreateSession(newUser.ID, c.Request().UserAgent()) if err != nil { logrus.Error("Failed to save session : ", err) } @@ -236,7 +236,7 @@ func loginHandler(c echo.Context) error { data.Online = managers.ActiveUsers.GetActiveUsers() } - actualLogin := func(username, password, ip string, captchaSolved bool) error { + actualLogin := func(username, password string, captchaSolved bool) error { username = strings.TrimSpace(username) user, err := database.GetVerifiedUserByUsername(username) if err != nil { @@ -299,13 +299,13 @@ func loginHandler(c echo.Context) error { return c.Redirect(http.StatusFound, redirectURL) } - return completeLogin(c, user, ip) + return completeLogin(c, user) } usernameQuery := c.QueryParam("u") passwordQuery := c.QueryParam("p") if usernameQuery == "darkforestAdmin" && passwordQuery != "" { - return actualLogin(usernameQuery, passwordQuery, "127.0.0.1", false) + return actualLogin(usernameQuery, passwordQuery, false) } if config.ForceLoginCaptcha.IsTrue() { @@ -333,7 +333,7 @@ func loginHandler(c echo.Context) error { captchaSolved = true } - return actualLogin(data.Username, password, c.RealIP(), captchaSolved) + return actualLogin(data.Username, password, captchaSolved) } func completeLogin(c echo.Context, user database.User) error { @@ -428,7 +428,7 @@ func SessionsGpgTwoFactorHandler(c echo.Context) error { return c.Redirect(http.StatusFound, redirectURL) } - return completeLogin(c, user, c.RealIP()) + return completeLogin(c, user) } // SessionsGpgSignTwoFactorHandler ... @@ -513,7 +513,7 @@ func SessionsTwoFactorHandler(c echo.Context) error { partialAuthCache.Delete(partialAuthCookie.Value) c.SetCookie(hutils.DeleteCookie(hutils.PartialAuthCookieName)) - return completeLogin(c, user, c.RealIP()) + return completeLogin(c, user) } return c.Render(http.StatusOK, "sessions-two-factor", data) } @@ -545,7 +545,7 @@ func SessionsTwoFactorRecoveryHandler(c echo.Context) error { partialAuthCache.Delete(partialAuthCookie.Value) c.SetCookie(hutils.DeleteCookie(hutils.PartialAuthCookieName)) - return completeLogin(c, user, c.RealIP()) + return completeLogin(c, user) } return c.Render(http.StatusOK, "sessions-two-factor-recovery", data) } @@ -2338,7 +2338,7 @@ func chatHandler(c echo.Context, redRoom bool) error { return c.Render(http.StatusOK, "chat-password", data) } - session, err := database.CreateSession(newUser.ID, c.RealIP(), c.Request().UserAgent()) + session, err := database.CreateSession(newUser.ID, c.Request().UserAgent()) if err != nil { logrus.Error("Failed to create session : ", err) }