mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 12:30:19 +08:00
Return sms error message.
This commit is contained in:
@ -15,8 +15,6 @@
|
||||
package object
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/casdoor/go-sms-sender"
|
||||
)
|
||||
@ -35,14 +33,14 @@ func InitSmsClient() {
|
||||
client = go_sms_sender.NewSmsClient(provider, accessId, accessKey, sign, region, templateId, appId)
|
||||
}
|
||||
|
||||
func SendCodeToPhone(phone, code string) {
|
||||
func SendCodeToPhone(phone, code string) string {
|
||||
if client == nil {
|
||||
InitSmsClient()
|
||||
if client == nil {
|
||||
fmt.Println("Sms Config Error")
|
||||
return
|
||||
return "SMS config error"
|
||||
}
|
||||
}
|
||||
|
||||
param := make(map[string]string)
|
||||
if provider == "tencent" {
|
||||
param["0"] = code
|
||||
@ -50,4 +48,5 @@ func SendCodeToPhone(phone, code string) {
|
||||
param["code"] = code
|
||||
}
|
||||
client.SendMessage(param, phone)
|
||||
return ""
|
||||
}
|
||||
|
@ -51,8 +51,7 @@ func SendVerificationCodeToPhone(remoteAddr, dest string) string {
|
||||
return result
|
||||
}
|
||||
|
||||
SendCodeToPhone(dest, code)
|
||||
return ""
|
||||
return SendCodeToPhone(dest, code)
|
||||
}
|
||||
|
||||
func AddToVerificationRecord(remoteAddr, dest, code string) string {
|
||||
|
Reference in New Issue
Block a user