Add password reset functionality to user dashboard page

This commit is contained in:
2024-07-08 23:08:45 +07:00
parent f01407990f
commit 97a9e72d7b
9 changed files with 151 additions and 108 deletions

View File

@ -17,6 +17,7 @@ import (
uploadHandler "github.com/fossyy/filekeeper/handler/upload"
"github.com/fossyy/filekeeper/handler/upload/initialisation"
userHandler "github.com/fossyy/filekeeper/handler/user"
userHandlerResetPassword "github.com/fossyy/filekeeper/handler/user/ResetPassword"
userSessionTerminateHandler "github.com/fossyy/filekeeper/handler/user/session/terminate"
userHandlerTotpSetup "github.com/fossyy/filekeeper/handler/user/totp"
"github.com/fossyy/filekeeper/middleware"
@ -93,6 +94,10 @@ func SetupRoutes() *http.ServeMux {
middleware.Auth(userHandler.GET, w, r)
})
handler.HandleFunc("POST /user/reset-password", func(w http.ResponseWriter, r *http.Request) {
middleware.Auth(userHandlerResetPassword.POST, w, r)
})
handler.HandleFunc("DELETE /user/session/terminate/{id}", func(w http.ResponseWriter, r *http.Request) {
middleware.Auth(userSessionTerminateHandler.DELETE, w, r)
})