Skip to content

Commit 434a59a

Browse files
authored
fix: format test otps (supabase#1567)
## What kind of change does this PR introduce? * Apply basic formatting on test OTPs when config is loaded * Fixes supabase#1566 ## What is the current behavior? Please link any relevant issues here. ## What is the new behavior? Feel free to include screenshots if it includes visual changes. ## Additional context Add any other context or screenshots.
1 parent 170bd66 commit 434a59a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

internal/conf/configuration.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,15 @@ func (config *GlobalConfiguration) ApplyDefaults() error {
692692
config.Sms.OtpLength = 6
693693
}
694694

695+
if config.Sms.TestOTP != nil {
696+
formatTestOtps := make(map[string]string)
697+
for phone, otp := range config.Sms.TestOTP {
698+
phone = strings.ReplaceAll(strings.TrimPrefix(phone, "+"), " ", "")
699+
formatTestOtps[phone] = otp
700+
}
701+
config.Sms.TestOTP = formatTestOtps
702+
}
703+
695704
if len(config.Sms.Template) == 0 {
696705
config.Sms.Template = ""
697706
}

0 commit comments

Comments
 (0)