Add phone registration with SMS verification and regenerate Swagger docs.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
30
pkg/sms/sender.go
Normal file
30
pkg/sms/sender.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package sms
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"online-back/pkg/logging"
|
||||
)
|
||||
|
||||
// Sender delivers an SMS. Plug your provider in by implementing this
|
||||
// interface and passing it to auth.NewHandler.
|
||||
type Sender interface {
|
||||
Send(ctx context.Context, phone, message string) error
|
||||
}
|
||||
|
||||
// LogSender is a stand-in used until a real SMS client is wired in.
|
||||
// It logs the message (including the OTP) so local testing still works.
|
||||
type LogSender struct {
|
||||
logger *logging.Logger
|
||||
}
|
||||
|
||||
func NewLogSender(logger *logging.Logger) *LogSender {
|
||||
return &LogSender{logger: logger}
|
||||
}
|
||||
|
||||
func (s *LogSender) Send(_ context.Context, phone, message string) error {
|
||||
if s.logger != nil {
|
||||
s.logger.Infof("sms to %s: %s", phone, message)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user