diff --git a/handlers/jwt/jwtware.go b/handlers/jwt/jwtware.go index 9fc87e3c..be07437f 100644 --- a/handlers/jwt/jwtware.go +++ b/handlers/jwt/jwtware.go @@ -7,7 +7,6 @@ import ( "github.com/gofiber/fiber/v2" "userstyles.world/config" - "userstyles.world/modules/errors" ) var ( diff --git a/handlers/server.go b/handlers/server.go index 8ef9ee60..470372b1 100644 --- a/handlers/server.go +++ b/handlers/server.go @@ -106,7 +106,6 @@ func Initialize() { app.Get("/logout", jwtware.Protected, user.Logout) app.Get("/account", jwtware.Protected, user.Account) app.Post("/account", jwtware.Protected, user.EditAccount) - app.Post("/style/:id", jwtware.Protected, style.DeleteByID) app.Get("/add", jwtware.Protected, style.CreateGet) app.Post("/add", jwtware.Protected, style.CreatePost) app.Get("/delete/:id", jwt.Protected, style.DeleteGet) diff --git a/models/user.go b/models/user.go index dc021d80..3ac42107 100644 --- a/models/user.go +++ b/models/user.go @@ -121,7 +121,7 @@ func FindUserByID(db *gorm.DB, id string) (*User, error) { } if user.ID == 0 { - return nil, errors.New("user not found") + return nil, errors.UserNotFound } return user, nil diff --git a/utils/chacha20poly1305.go b/utils/chacha20poly1305.go index 269f6572..5fe6ce56 100644 --- a/utils/chacha20poly1305.go +++ b/utils/chacha20poly1305.go @@ -2,6 +2,7 @@ package utils import ( "crypto/cipher" + "fmt" "github.com/form3tech-oss/jwt-go" "golang.org/x/crypto/chacha20poly1305" @@ -60,7 +61,7 @@ func OpenText(encryptedMsg string, aead cipher.AEAD) ([]byte, error) { } func VerifyJwtKeyFunction(t *jwt.Token) (interface{}, error) { - if t.Method.Alg() != verifySigningMethod { + if t.Method.Alg() != signingMethod { return nil, errors.UnexpectedSigningMethod(t.Method.Alg()) } return VerifySigningKey, nil