Actually send SMS on the test page
This commit is contained in:
parent
2626e044ca
commit
67a7d20f6c
1 changed files with 8 additions and 1 deletions
|
|
@ -4,6 +4,8 @@ import (
|
|||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/Gleipnir-Technology/nidus-sync/comms/text"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/config"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/db/enums"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/db/models"
|
||||
"github.com/gorilla/schema"
|
||||
|
|
@ -37,6 +39,11 @@ func postSudoSMS(ctx context.Context, u *models.User, sms FormSMS) (string, *err
|
|||
Status: http.StatusForbidden,
|
||||
}
|
||||
}
|
||||
log.Info().Str("msg", sms.Message).Str("phone", sms.Phone).Msg("Got SMS")
|
||||
id, err := text.SendText(ctx, config.VoipMSNumber, sms.Phone, sms.Message)
|
||||
if err != nil {
|
||||
log.Warn().Err(err).Msg("Failed to send SMS")
|
||||
} else {
|
||||
log.Info().Str("id", id).Msg("Sent SMS")
|
||||
}
|
||||
return "/sudo", nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue