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 and LashaJini committed Nov 15, 2024
1 parent e366ecd commit ddaec54
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 ddaec54

Please sign in to comment.