commit a7b29df7f80e6069c08ec1cf232fb626fa9a44ec
parent 0fe81e8382face34604a7bb956dccd1ae1b30a8f
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Sat, 3 Dec 2022 20:01:18 -0500
remove dead code
Diffstat:
1 file changed, 1 insertion(+), 40 deletions(-)
diff --git a/pkg/web/handlers/handlers.go b/pkg/web/handlers/handlers.go
@@ -1132,7 +1132,7 @@ func ForgotPasswordHandler(c echo.Context) error {
if !found {
return c.Redirect(http.StatusFound, "/")
}
-
+
token, found := pgpTokenCache.Get(userID)
if !found {
return c.Redirect(http.StatusFound, "/")
@@ -1210,45 +1210,6 @@ func ForgotPasswordHandler(c echo.Context) error {
return c.Render(http.StatusOK, "flash", FlashResponse{"should not go here", "/login", "alert-danger"})
}
-// ForgotPasswordResetHandler handler for the page to actually reset the password.
-func ForgotPasswordResetHandler(c echo.Context) error {
- // If already logged in, redirect.
- authUser := c.Get("authUser").(*database.User)
- if authUser != nil {
- return c.Redirect(http.StatusFound, "/")
- }
-
- var data forgotPasswordResetData
- token := c.Param("token")
-
- user, err := database.GetVerifiedUserBySessionID(token)
- if err != nil {
- return c.Redirect(http.StatusFound, "/")
- }
-
- data.Username = user.Username
-
- if c.Request().Method == http.MethodGet {
- return c.Render(http.StatusOK, "forgot-password-reset", data)
- }
-
- data.Password = c.Request().PostFormValue("password")
- data.RePassword = c.Request().PostFormValue("repassword")
-
- hashedPassword, err := database.NewPasswordValidator(data.Password).CompareWith(data.RePassword).Hash()
- if err != nil {
- data.Error = err.Error()
- return c.Render(http.StatusOK, "forgot-password-reset", data)
- }
-
- user.Token = nil
- if err := user.ChangePassword(hashedPassword); err != nil {
- logrus.Error(err)
- }
-
- return c.Render(http.StatusOK, "flash", FlashResponse{"Your password was changed", "/login", "alert-success"})
-}
-
func NewsHandler(c echo.Context) error {
var data newsData
return c.Render(http.StatusOK, "news", data)