Skip to content

Commit

Permalink
fix: format test otps (supabase#1567)
Browse files Browse the repository at this point in the history
## 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.
  • Loading branch information
kangmingtay authored Apr 30, 2024
1 parent 170bd66 commit 434a59a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/conf/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,15 @@ func (config *GlobalConfiguration) ApplyDefaults() error {
config.Sms.OtpLength = 6
}

if config.Sms.TestOTP != nil {
formatTestOtps := make(map[string]string)
for phone, otp := range config.Sms.TestOTP {
phone = strings.ReplaceAll(strings.TrimPrefix(phone, "+"), " ", "")
formatTestOtps[phone] = otp
}
config.Sms.TestOTP = formatTestOtps
}

if len(config.Sms.Template) == 0 {
config.Sms.Template = ""
}
Expand Down

0 comments on commit 434a59a

Please sign in to comment.