Skip to content

Commit

Permalink
send regular context to domain
Browse files Browse the repository at this point in the history
  • Loading branch information
fmartingr committed Dec 24, 2024
1 parent c1efe01 commit 9734436
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/http/middleware/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func AuthMiddleware(deps *dependencies.Dependencies) gin.HandlerFunc {
token = getTokenFromCookie(c)
}

account, err := deps.Domains.Auth.CheckToken(c, token)
account, err := deps.Domains.Auth.CheckToken(c.Request.Context(), token)
if err != nil {
deps.Log.WithError(err).Error("Failed to check token")
return
Expand Down
4 changes: 2 additions & 2 deletions internal/http/routes/api/v1/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func (r *AuthAPIRoutes) updateHandler(c *gin.Context) {

// If trying to update password, check if old password is correct
if payload.NewPassword != "" {
_, err := r.deps.Domains.Auth.GetAccountFromCredentials(c, account.Username, payload.OldPassword)
_, err := r.deps.Domains.Auth.GetAccountFromCredentials(c.Request.Context(), account.Username, payload.OldPassword)
if err != nil {
response.SendError(c, http.StatusBadRequest, "Old password is incorrect")
return
Expand All @@ -221,7 +221,7 @@ func (r *AuthAPIRoutes) updateHandler(c *gin.Context) {
updatedAccount := payload.ToAccountDTO()
updatedAccount.ID = account.ID

account, err := r.deps.Domains.Accounts.UpdateAccount(c, updatedAccount)
account, err := r.deps.Domains.Accounts.UpdateAccount(c.Request.Context(), updatedAccount)
if err != nil {
r.deps.Log.WithError(err).Error("failed to update account")
response.SendInternalServerError(c)
Expand Down

0 comments on commit 9734436

Please sign in to comment.