This commit is contained in:
2026-09-16 11:42:06 +05:30
parent bf5a9026fe
commit 25bc33975c
7 changed files with 482 additions and 3 deletions

View File

@@ -39,6 +39,17 @@ type logSender struct{}
func (logSender) Name() string { return "log" }
func (logSender) Send(phone, message string) error {
// In production this is a failure, not a fallback. A code that only
// reaches the application log has not been delivered, and returning nil
// reports a send that did not happen: the customer waits for a text that
// is never coming, and the endpoint cheerfully answers sent:true. An
// error at least surfaces as a clear failure on the sign-in screen.
if strings.EqualFold(strings.TrimSpace(os.Getenv("ENV")), "production") {
utils.Error("SMS NOT CONFIGURED in production — refusing to write a live "+
"verification code to the log. Set SMS_GATEWAY_URL.", "phone", maskPhone(phone))
return fmt.Errorf("sms: no gateway configured")
}
utils.Warn("SMS NOT CONFIGURED — code written to the log instead of being sent",
"phone", maskPhone(phone), "message", message)
return nil