first
continuous-integration/drone/push Build is passing Details

master
NY 4 weeks ago
parent 2b2b9c9d7a
commit e595ba3244

@ -7,6 +7,7 @@ import (
"epur-pay/pkg/utils" "epur-pay/pkg/utils"
"fmt" "fmt"
"golang.org/x/crypto/bcrypt" "golang.org/x/crypto/bcrypt"
"regexp"
) )
type SsoLoginParams struct { type SsoLoginParams struct {
@ -33,6 +34,12 @@ type SsoLoginResponse struct {
func SsoLogin(a *dapi.ApiBase, data *SsoLoginParams) error { func SsoLogin(a *dapi.ApiBase, data *SsoLoginParams) error {
Response := SsoLoginResponse{} Response := SsoLoginResponse{}
mobileRegex := `^1[3-9]\d{9}$`
matched, err := regexp.MatchString(mobileRegex, data.Mobile)
if err != nil || !matched {
return a.ReturnPublicErrorResponse(a.Translate("invalid_mobile"))
}
user := model.User{} user := model.User{}
utils.Error(a.Ts.Table(user.TableName()).Where("mobile", data.Mobile).Scan(&user).Error) utils.Error(a.Ts.Table(user.TableName()).Where("mobile", data.Mobile).Scan(&user).Error)

Loading…
Cancel
Save