Skip to content

fix(auth): store reset token expiry in SQLite datetime format - #58

Merged
ralyodio merged 1 commit into
moshcoder:masterfrom
qwenbona:fix/reset-token-expiry
Jul 30, 2026
Merged

fix(auth): store reset token expiry in SQLite datetime format#58
ralyodio merged 1 commit into
moshcoder:masterfrom
qwenbona:fix/reset-token-expiry

Conversation

@qwenbona

Copy link
Copy Markdown
Contributor

toISOString() produces YYYY-MM-DDTHH:MM:SS.mmmZ but SQLite datetime(now) returns YYYY-MM-DD HH:MM:SS. The T (0x54) always sorts after space (0x20), so the lexical comparison in accountForResetToken makes tokens appear valid for up to ~24h instead of the intended 1 hour.

Store in SQLite native format so the comparison is correct.

Fixes #44

toISOString() produces 'YYYY-MM-DDTHH:MM:SS.mmmZ' but SQLite's
datetime('now') returns 'YYYY-MM-DD HH:MM:SS'. The lexical comparison
in accountForResetToken always evaluates incorrectly because 'T' (0x54)
sorts after space (0x20), so tokens appear valid for up to ~24h instead
of the intended 1 hour.

Store in SQLite's native format so the comparison is correct.

Fixes moshcoder#44
@ralyodio
ralyodio merged commit 1b53e34 into moshcoder:master Jul 30, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants