diff --git a/internal/api/mfa.go b/internal/api/mfa.go index ebb6be65e..3e97fcd68 100644 --- a/internal/api/mfa.go +++ b/internal/api/mfa.go @@ -593,7 +593,10 @@ func (a *API) verifyPhoneFactor(w http.ResponseWriter, r *http.Request, params * var otpCode string var shouldReEncrypt bool if config.Sms.IsTwilioVerifyProvider() { - smsProvider, _ := sms_provider.GetSmsProvider(*config) + smsProvider, err := sms_provider.GetSmsProvider(*config) + if err != nil { + return internalServerError("Failed to get SMS provider").WithInternalError(err) + } if err := smsProvider.VerifyOTP(factor.Phone.String(), params.Code); err != nil { return forbiddenError(ErrorCodeOTPExpired, "Token has expired or is invalid").WithInternalError(err) } diff --git a/internal/api/phone_test.go b/internal/api/phone_test.go index 468c39955..adc50f1a9 100644 --- a/internal/api/phone_test.go +++ b/internal/api/phone_test.go @@ -35,6 +35,9 @@ func (t *TestSmsProvider) SendMessage(phone, message, channel, otp string) (stri t.SentMessages += 1 return "", nil } +func (t *TestSmsProvider) VerifyOTP(phone, otp string) error { + return nil +} func TestPhone(t *testing.T) { api, config, err := setupAPIForTest()