feat: suppor tokenDelivery field for account reg

This commit is contained in:
2025-12-16 00:41:30 +00:00
parent bab6e24a0d
commit 3686f87377
6 changed files with 85 additions and 28 deletions

View File

@@ -11,8 +11,8 @@ import (
)
const (
tokenDeliveryCookie = "cookie"
tokenDeliveryBody = "body"
TokenDeliveryCookie = "cookie"
TokenDeliveryBody = "body"
)
const (
@@ -113,13 +113,13 @@ func (h *HTTPHandler) Login(c *fiber.Ctx) error {
default:
return c.Status(fiber.StatusBadRequest).JSON(fiber.Map{"error": "invalid token delivery method"})
case tokenDeliveryCookie:
setAuthCookies(c, result.AccessToken, result.RefreshToken, h.cookieConfig)
case TokenDeliveryCookie:
SetAuthCookies(c, result.AccessToken, result.RefreshToken, h.cookieConfig)
return c.JSON(loginResponse{
User: *result.User,
})
case tokenDeliveryBody:
case TokenDeliveryBody:
return c.JSON(loginResponse{
User: *result.User,
AccessToken: result.AccessToken,