Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions internal/api/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type LimiterOptions struct {
Phone ratelimit.Limiter

Signups *limiter.Limiter
SignIns *limiter.Limiter
AnonymousSignIns *limiter.Limiter
Recover *limiter.Limiter
Resend *limiter.Limiter
Expand Down Expand Up @@ -106,8 +107,9 @@ func NewLimiterOptions(gc *conf.GlobalConfiguration) *LimiterOptions {
o.MagicLink = newLimiterPer5mOver1h(gc.RateLimitOtp)
o.Otp = newLimiterPer5mOver1h(gc.RateLimitOtp)
o.User = newLimiterPer5mOver1h(gc.RateLimitOtp)
o.Signups = newLimiterPer5mOver1h(gc.RateLimitOtp)
o.OAuthClientRegister = newLimiterPer5mOver1h(gc.RateLimitOAuthDynamicClientRegister)
o.Signups = newLimiterPer5mOver1h(gc.RateLimitSignInSignUps)
o.SignIns = newLimiterPer5mOver1h(gc.RateLimitSignInSignUps)
o.OAuthClientRegister = newLimiterPer5mOver1h(gc.RateLimitOAuthDynamicClientRegister)
Comment on lines +111 to +112
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 111 and 112 use spaces for indentation instead of tabs, which is inconsistent with the rest of the file. Please use tabs to match the surrounding code.

Suggested change
o.SignIns = newLimiterPer5mOver1h(gc.RateLimitSignInSignUps)
o.OAuthClientRegister = newLimiterPer5mOver1h(gc.RateLimitOAuthDynamicClientRegister)
o.SignIns = newLimiterPer5mOver1h(gc.RateLimitSignInSignUps)
o.OAuthClientRegister = newLimiterPer5mOver1h(gc.RateLimitOAuthDynamicClientRegister)

Copilot uses AI. Check for mistakes.

return o
}
Expand Down
5 changes: 4 additions & 1 deletion internal/api/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,20 @@ func (a *API) Token(w http.ResponseWriter, r *http.Request) error {
grantType := r.FormValue("grant_type")

handler := a.ResourceOwnerPasswordGrant
limiter := a.limiterOpts.Token
limiter := a.limiterOpts.SignIns

switch grantType {
case "password":
// set above
case "refresh_token":
handler = a.RefreshTokenGrant
limiter = a.limiterOpts.Token
case "id_token":
handler = a.IdTokenGrant
limiter = a.limiterOpts.Token
case "pkce":
handler = a.PKCE
limiter = a.limiterOpts.Token
case "web3":
handler = a.Web3Grant
limiter = a.limiterOpts.Web3
Expand Down
1 change: 1 addition & 0 deletions internal/conf/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ type GlobalConfiguration struct {
RateLimitSso float64 `split_words:"true" default:"30"`
RateLimitAnonymousUsers float64 `split_words:"true" default:"30"`
RateLimitOtp float64 `split_words:"true" default:"30"`
RateLimitSignInSignUps float64 `split_words:"true" default:"30"`
RateLimitWeb3 float64 `split_words:"true" default:"30"`
RateLimitOAuthDynamicClientRegister float64 `split_words:"true" default:"10"`

Expand Down
Loading