Update user.go
This commit is contained in:
parent
fa78b96d0e
commit
2d2ede9a7e
@ -5,6 +5,7 @@ import (
|
||||
"errors"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"go.uber.org/zap"
|
||||
"strings"
|
||||
"penahub.gitlab.yandexcloud.net/backend/quiz/core.git/middleware"
|
||||
)
|
||||
|
||||
@ -77,13 +78,13 @@ func (c *Controller) GetCurrentAccount(ctx *fiber.Ctx) error {
|
||||
func (c *Controller) ConnectAccount(ctx *fiber.Ctx) error {
|
||||
authHeader := c.Get("Authorization")
|
||||
if authHeader == "" {
|
||||
c.Status(fiber.StatusUnauthorized).SendString("no JWT found")
|
||||
ctx.Status(fiber.StatusUnauthorized).SendString("no JWT found")
|
||||
return nil
|
||||
}
|
||||
|
||||
tokenString := strings.TrimPrefix(authHeader, "Bearer ")
|
||||
if tokenString == authHeader {
|
||||
c.Status(fiber.StatusUnauthorized).SendString("invalid JWT Header: missing Bearer")
|
||||
ctx.Status(fiber.StatusUnauthorized).SendString("invalid JWT Header: missing Bearer")
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user