fix(auth): 公开登录门按来源限速并设全站发信上限,冷却表定期清理
This commit is contained in:
26 files changed
+1141
-64
No files matched your search
@@ -3,9 +3,12 @@ package api
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"slices"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"felis.lolicon.best/internal/metrics"
|
||||
)
|
||||
|
||||
// The per-code attempt cap resets on every resend; these pin the account-level
|
||||
@@ -181,3 +184,14 @@ func TestOTPLockNoticeNamesDoorAndTime(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The lockout alert sees a purpose only if metrics pre-creates its series.
|
||||
func TestOTPPurposesMatchMetricLabels(t *testing.T) {
|
||||
got := []string{otpPurposeOnboard, otpPurposeLogin, otpPurposeOpLogin, otpPurposeMigrate}
|
||||
want := slices.Clone(metrics.OTPPurposes)
|
||||
slices.Sort(got)
|
||||
slices.Sort(want)
|
||||
if !slices.Equal(got, want) {
|
||||
t.Fatalf("otp purposes %v, metrics.OTPPurposes %v", got, want)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user