Skip to content

Commit

Permalink
fix: sync deleteJWTcredential when changing password
Browse files Browse the repository at this point in the history
  • Loading branch information
ppolariss authored Mar 5, 2025
1 parent 55b2627 commit 807c522
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions apis/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,15 +393,14 @@ func ChangePassword(c *fiber.Ctx) error {
}

if !config.Config.Standalone {
userID := user.ID
go func() {
err = kong.DeleteJwtCredential(userID)
if err != nil {
log.Warn().Err(err).Int("user_id", userID).Msg("failed to delete jwt credential")
}
}()
err = kong.DeleteJwtCredential(user.ID)
if err != nil {
// When deleting a JWT, if the JWT does not exist, no error is thrown.
log.Warn().Err(err).Int("user_id", user.ID).Msg("failed to delete jwt credential")
}
}

// Do NOT async deleteJwt to ensure that newly created JWTs are not deleted.
accessToken, refreshToken, err := user.CreateJWTToken()
if err != nil {
return err
Expand Down

0 comments on commit 807c522

Please sign in to comment.