Commit 4c7b66a
committed
fix: fix broken timezone mismatch detection in session tracking
geo.timezone from geoip-lite is an IANA string (e.g. "America/New_York"),
not a numeric offset. parseInt() on it always returns NaN, making the
comparison always false — the timezone mismatch security flag never fires.
Convert the IANA timezone to a minute offset using toLocaleString() with
the timeZone option, then compare against the browser-reported offset.
Wrap in try/catch for invalid IANA timezone strings.1 parent 707ae28 commit 4c7b66a
1 file changed
+15
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
260 | 267 | | |
261 | 268 | | |
262 | 269 | | |
| |||
0 commit comments