fix: restructure handler.go #181
All checks were successful
Build Docker Image / Explore-Gitea-Actions (push) Successful in 45s
Build and Push Docker Image / Explore-Gitea-Actions (push) Successful in 46s

This commit was merged in pull request #182.
This commit is contained in:
2024-09-15 11:38:51 +02:00
parent 1476aa9842
commit 6f22e066ab
4 changed files with 48 additions and 35 deletions

27
handler/auth.go Normal file
View File

@@ -0,0 +1,27 @@
package handler
import (
"me-fit/service"
"database/sql"
"net/http"
)
func handleAuth(db *sql.DB, router *http.ServeMux) {
// Don't use auth middleware for these routes, as it makes redirecting very difficult, if the mail is not yet verified
router.Handle("/auth/signin", service.HandleSignInPage(db))
router.Handle("/auth/signup", service.HandleSignUpPage(db))
router.Handle("/auth/verify", service.HandleSignUpVerifyPage(db)) // Hint for the user to verify their email
router.Handle("/auth/delete-account", service.HandleDeleteAccountPage(db))
router.Handle("/auth/verify-email", service.HandleSignUpVerifyResponsePage(db)) // The link contained in the email
router.Handle("/auth/change-password", service.HandleChangePasswordPage(db))
router.Handle("/auth/reset-password", service.HandleResetPasswordPage(db))
router.Handle("/api/auth/signup", service.HandleSignUpComp(db))
router.Handle("/api/auth/signin", service.HandleSignInComp(db))
router.Handle("/api/auth/signout", service.HandleSignOutComp(db))
router.Handle("/api/auth/delete-account", service.HandleDeleteAccountComp(db))
router.Handle("/api/auth/verify-resend", service.HandleVerifyResendComp(db))
router.Handle("/api/auth/change-password", service.HandleChangePasswordComp(db))
router.Handle("/api/auth/reset-password", service.HandleResetPasswordComp(db))
router.Handle("/api/auth/reset-password-actual", service.HandleActualResetPasswordComp(db))
}