fix: some bugs about SMS API (#310)

Signed-off-by: “seriouszyx” <674965440@qq.com>
This commit is contained in:
Yixiang Zhao
2021-10-31 08:49:39 +08:00
committed by GitHub
parent b7f2f9056f
commit 609e9785e4
3 changed files with 10 additions and 6 deletions

View File

@ -63,7 +63,7 @@ func (c *ApiController) SendVerificationCode() {
user := c.getCurrentUser()
organization := object.GetOrganization(orgId)
application := object.GetApplicationByOrganizationName(organization.Name)
sendResp := errors.New("Invalid dest type.")
switch destType {
case "email":
@ -90,12 +90,12 @@ func (c *ApiController) SendVerificationCode() {
sendResp = object.SendVerificationCodeToPhone(organization, user, provider, remoteAddr, dest)
}
status := "ok"
if sendResp != nil {
status = "error"
c.Data["json"] = Response{Status: "error", Msg: sendResp.Error()}
} else {
c.Data["json"] = Response{Status: "ok"}
}
c.Data["json"] = Response{Status: status, Msg: sendResp.Error()}
c.ServeJSON()
}