summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2026-10-17 11:50:34 -0700
committerRose Hogenson <rosehogenson@posteo.net>2026-10-17 11:50:39 -0700
commit707726463a52cb2cebf9a174149995852632d26d (patch)
tree78da6bde391e9e5fb9c910c9758953aa1c202b77
parentUse a more insane cookie format (diff)
downloadroseh.moe-707726463a52cb2cebf9a174149995852632d26d.tar.zst
Allow for the clock to be slightly behindHEADmain
-rw-r--r--roseh.moe.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/roseh.moe.go b/roseh.moe.go
index 2640250..0369740 100644
--- a/roseh.moe.go
+++ b/roseh.moe.go
@@ -813,7 +813,7 @@ func totp(t int64) []byte {
func checkOTP(auth string) int {
now := time.Now().Unix() / 30
- return subtle.ConstantTimeCompare([]byte(auth), totp(now)) | subtle.ConstantTimeCompare([]byte(auth), totp(now-1))
+ return subtle.ConstantTimeCompare([]byte(auth), totp(now-1)) | subtle.ConstantTimeCompare([]byte(auth), totp(now)) | subtle.ConstantTimeCompare([]byte(auth), totp(now+1))
}
func checkPassword(password string) int {