[PR #4273] [MERGED] fix: schema onUpdate not working #5285

Closed
opened 2026-03-13 12:16:53 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4273
Author: @himself65
Created: 8/27/2025
Status: Merged
Merged: 8/27/2025
Merged by: @himself65

Base: canaryHead: himself65/2025/08/27/fix-on-update


📝 Commits (1)

  • 0a1ac00 fix: onUpdate field not working

📊 Changes

4 files changed (+176 additions, -4 deletions)

View changed files

📝 packages/better-auth/src/adapters/create-adapter/index.ts (+3 -2)
📝 packages/better-auth/src/adapters/utils.ts (+7 -0)
📝 packages/better-auth/src/api/routes/reset-password.test.ts (+91 -1)
📝 packages/better-auth/src/api/routes/update-user.test.ts (+75 -1)

📄 Description

Fixes: https://github.com/better-auth/better-auth/pull/4241

Summary by cubic

Fixes onUpdate not being applied during updates. Fields like account.updatedAt now refresh correctly on password reset and password change.

  • Bug Fixes
    • Ensure onUpdate runs when updating and the incoming value is undefined (adapter logic and withApplyDefault).
    • Add tests for resetPassword and changePassword that verify account.updatedAt is updated and new credentials work.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/4273 **Author:** [@himself65](https://github.com/himself65) **Created:** 8/27/2025 **Status:** ✅ Merged **Merged:** 8/27/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `himself65/2025/08/27/fix-on-update` --- ### 📝 Commits (1) - [`0a1ac00`](https://github.com/better-auth/better-auth/commit/0a1ac0074871e17e68990a903b269b636a888b8d) fix: onUpdate field not working ### 📊 Changes **4 files changed** (+176 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/adapters/create-adapter/index.ts` (+3 -2) 📝 `packages/better-auth/src/adapters/utils.ts` (+7 -0) 📝 `packages/better-auth/src/api/routes/reset-password.test.ts` (+91 -1) 📝 `packages/better-auth/src/api/routes/update-user.test.ts` (+75 -1) </details> ### 📄 Description Fixes: https://github.com/better-auth/better-auth/pull/4241 <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Fixes onUpdate not being applied during updates. Fields like account.updatedAt now refresh correctly on password reset and password change. - **Bug Fixes** - Ensure onUpdate runs when updating and the incoming value is undefined (adapter logic and withApplyDefault). - Add tests for resetPassword and changePassword that verify account.updatedAt is updated and new credentials work. <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 12:16:54 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#5285