mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 04:10:20 +08:00
feat: support multiple country codes for sending SMS (#1557)
* feat: support multiple country code * feat: improve UI * feat: migrate accountItem * fix: Aliyun compatible * fix: phone validate * fix: typo
This commit is contained in:
@ -130,13 +130,13 @@ func (c *ApiController) SendSms() {
|
||||
return
|
||||
}
|
||||
|
||||
org := object.GetOrganization(smsForm.OrgId)
|
||||
var invalidReceivers []string
|
||||
for idx, receiver := range smsForm.Receivers {
|
||||
if !util.IsPhoneCnValid(receiver) {
|
||||
// The receiver phone format: E164 like +8613854673829 +441932567890
|
||||
if !util.IsPhoneValid(receiver, "") {
|
||||
invalidReceivers = append(invalidReceivers, receiver)
|
||||
} else {
|
||||
smsForm.Receivers[idx] = fmt.Sprintf("+%s%s", org.PhonePrefix, receiver)
|
||||
smsForm.Receivers[idx] = receiver
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user