IA-950 : Fix: Password Reset Code Expiration Failing in Production Due to Timezone Mismatch
Problem
Password reset codes were expiring immediately in the staging environment, even when freshly generated. The issue did not appear in local development.
Root Cause
The LocalDateTime values stored in the database (via Hibernate) and the
LocalDateTime.now() used for expiration comparison were inconsistent across
environments due to timezone differences between the local JVM (UTC+1) and
the production server (UTC).
Changes
- Added
hibernate.jdbc.time_zone: UTCinapplication-local.ymlandapplication-rec.ymlto ensure Hibernate reads/writes timestamps in UTC - Applied
LocalDateTime.now(ZoneOffset.UTC)specifically inrequestPasswordResetCode()for storing expiration timestamps - Applied
LocalDateTime.now(ZoneOffset.UTC)inconfirmPasswordResetCode()for comparing expiration timestamps - Applied
LocalDateTime.now(ZoneOffset.UTC)in 2FA code generation and verification methods
Scope
Only expiration-related timestamp comparisons are affected.
Other LocalDateTime.now() usages (lastLogin, etc.) remain unchanged.