diff --git a/backend/go.mod b/backend/go.mod index 396fdc23d..4e6367057 100644 --- a/backend/go.mod +++ b/backend/go.mod @@ -14,8 +14,10 @@ require ( github.com/huandu/go-assert v1.1.6 github.com/mcnijman/go-emailaddress v1.1.1 github.com/mitchellh/mapstructure v1.5.0 + github.com/resend/resend-go/v2 v2.5.0 github.com/spf13/viper v1.18.2 github.com/swaggo/swag v1.16.3 + golang.org/x/crypto v0.19.0 golang.org/x/text v0.14.0 gorm.io/driver/postgres v1.5.6 gorm.io/gorm v1.25.7 @@ -24,13 +26,9 @@ require ( require ( github.com/awnumar/memcall v0.2.0 // indirect github.com/awnumar/memguard v0.22.4 // indirect - github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 // indirect github.com/philhofer/fwd v1.1.2 // indirect - github.com/pquerna/otp v1.4.0 // indirect - github.com/resend/resend-go/v2 v2.5.0 // indirect github.com/tinylib/msgp v1.1.8 // indirect - golang.org/x/term v0.17.0 // indirect ) require ( diff --git a/backend/go.sum b/backend/go.sum index 3d27cb3cf..15a31dc06 100644 --- a/backend/go.sum +++ b/backend/go.sum @@ -6,8 +6,6 @@ github.com/awnumar/memcall v0.2.0 h1:sRaogqExTOOkkNwO9pzJsL8jrOV29UuUW7teRMfbqtI github.com/awnumar/memcall v0.2.0/go.mod h1:S911igBPR9CThzd/hYQQmTc9SWNu3ZHIlCGaWsWsoJo= github.com/awnumar/memguard v0.22.4 h1:1PLgKcgGPeExPHL8dCOWGVjIbQUBgJv9OL0F/yE1PqQ= github.com/awnumar/memguard v0.22.4/go.mod h1:+APmZGThMBWjnMlKiSM1X7MVpbIVewen2MTkqWkA/zE= -github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc h1:biVzkmvwrH8WK8raXaxBx6fRVTlJILwEwQGL1I/ByEI= -github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= @@ -102,8 +100,6 @@ github.com/philhofer/fwd v1.1.2/go.mod h1:qkPdfjR2SIEbspLqpe1tO4n5yICnr2DY7mqEx2 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pquerna/otp v1.4.0 h1:wZvl1TIVxKRThZIBiwOOHOGP/1+nZyWBil9Y2XNEDzg= -github.com/pquerna/otp v1.4.0/go.mod h1:dkJfzwRKNiegxyNb54X/3fLwhCynbMspSyWKnvi1AEg= github.com/resend/resend-go/v2 v2.5.0 h1:XzTtzQ9YB2LlGHWjS5AVyUqV9cVbDU+6Z4XgCKsJh4g= github.com/resend/resend-go/v2 v2.5.0/go.mod h1:ihnxc7wPpSgans8RV8d8dIF4hYWVsqMK5KxXAr9LIos= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= @@ -186,8 +182,6 @@ golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= -golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U= -golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= diff --git a/backend/src/config/resend.go b/backend/src/config/resend.go index 7feef66d5..be10b52f0 100644 --- a/backend/src/config/resend.go +++ b/backend/src/config/resend.go @@ -25,4 +25,4 @@ func readResendSettings() (*ResendSettings, error) { return &ResendSettings{ APIKey: secretAPIKey, }, nil -} \ No newline at end of file +} diff --git a/backend/src/server/server.go b/backend/src/server/server.go index 99a224fa6..c409804af 100644 --- a/backend/src/server/server.go +++ b/backend/src/server/server.go @@ -38,7 +38,6 @@ func Init(db *gorm.DB, settings config.Settings) *fiber.App { authMiddleware := middleware.NewAuthAuthMiddlewareService(db, validate, settings.Auth) emailService := auth.NewEmailService() - apiv1 := app.Group("/api/v1") apiv1.Use(authMiddleware.Authenticate) diff --git a/backend/src/services/auth.go b/backend/src/services/auth.go index 260465ce9..0bff1d376 100644 --- a/backend/src/services/auth.go +++ b/backend/src/services/auth.go @@ -24,14 +24,14 @@ type AuthServiceInterface interface { type AuthService struct { DB *gorm.DB Validate *validator.Validate - Email *auth.EmailService + Email *auth.EmailService } func NewAuthService(db *gorm.DB, validate *validator.Validate, email *auth.EmailService) *AuthService { return &AuthService{ DB: db, Validate: validate, - Email: email, + Email: email, } } diff --git a/backend/src/transactions/password_reset.go b/backend/src/transactions/password_reset.go index 229e42a8f..7299247c5 100644 --- a/backend/src/transactions/password_reset.go +++ b/backend/src/transactions/password_reset.go @@ -11,8 +11,8 @@ import ( func SavePasswordResetToken(db *gorm.DB, userID uuid.UUID, token string) *errors.Error { passwordReset := models.PasswordReset{ - UserID: userID, - Token: token, + UserID: userID, + Token: token, ExpiresAt: time.Now().Add(time.Hour * 24).UTC(), } @@ -43,7 +43,6 @@ func GetPasswordResetToken(db *gorm.DB, token string) (*models.PasswordReset, *e return &passwordReset, nil } - func GetActivePasswordResetTokenByUserID(db *gorm.DB, userID uuid.UUID) (*models.PasswordReset, *errors.Error) { passwordReset := models.PasswordReset{} if err := db.Where("user_id = ? AND expires_at > ?", userID, time.Now().UTC()).First(&passwordReset).Error; err != nil { @@ -54,4 +53,4 @@ func GetActivePasswordResetTokenByUserID(db *gorm.DB, userID uuid.UUID) (*models } return &passwordReset, nil -} \ No newline at end of file +}