diff --git a/internal/start/start.go b/internal/start/start.go index 72f34b8e7..f881665f4 100644 --- a/internal/start/start.go +++ b/internal/start/start.go @@ -485,6 +485,8 @@ EOF fmt.Sprintf("GOTRUE_EXTERNAL_EMAIL_ENABLED=%v", utils.Config.Auth.Email.EnableSignup), fmt.Sprintf("GOTRUE_MAILER_SECURE_EMAIL_CHANGE_ENABLED=%v", utils.Config.Auth.Email.DoubleConfirmChanges), fmt.Sprintf("GOTRUE_MAILER_AUTOCONFIRM=%v", !utils.Config.Auth.Email.EnableConfirmations), + fmt.Sprintf("GOTRUE_MAILER_OTP_LENGTH=%v", utils.Config.Auth.Email.OtpLength), + fmt.Sprintf("GOTRUE_MAILER_OTP_EXP=%v", utils.Config.Auth.Email.OtpExpiry), fmt.Sprintf("GOTRUE_EXTERNAL_ANONYMOUS_USERS_ENABLED=%v", utils.Config.Auth.EnableAnonymousSignIns), diff --git a/pkg/config/config.go b/pkg/config/config.go index 7fc8942b5..d3d29f3e4 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -258,6 +258,8 @@ type ( Template map[string]emailTemplate `toml:"template"` Smtp smtp `toml:"smtp"` MaxFrequency time.Duration `toml:"max_frequency"` + OtpLength uint `toml:"otp_length"` + OtpExpiry uint `toml:"otp_expiry"` } smtp struct { diff --git a/pkg/config/templates/config.toml b/pkg/config/templates/config.toml index 112237748..db1f18394 100644 --- a/pkg/config/templates/config.toml +++ b/pkg/config/templates/config.toml @@ -121,6 +121,10 @@ enable_confirmations = false secure_password_change = false # Controls the minimum amount of time that must pass before sending another signup confirmation or password reset email. max_frequency = "1s" +# Number of characters used in the email OTP. +otp_length = 6 +# Number of seconds before the email OTP expires (defaults to 1 hour). +otp_expiry = 3600 # Use a production-ready SMTP server # [auth.email.smtp] diff --git a/pkg/config/testdata/config.toml b/pkg/config/testdata/config.toml index 2f1a8e90d..43548a2fc 100644 --- a/pkg/config/testdata/config.toml +++ b/pkg/config/testdata/config.toml @@ -117,6 +117,10 @@ double_confirm_changes = true enable_confirmations = false # Controls the minimum amount of time that must pass before sending another signup confirmation or password reset email. max_frequency = "1s" +# Number of characters used in the email OTP. +otp_length = 6 +# Number of seconds before the email OTP expires. +otp_expiry = 300 # Use a production-ready SMTP server [auth.email.smtp]