mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-02 03:00:18 +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:
@ -170,3 +170,18 @@ func ClearUserOAuthProperties(user *User, providerType string) bool {
|
||||
|
||||
return affected != 0
|
||||
}
|
||||
|
||||
func (user *User) GetCountryCode(countryCode string) string {
|
||||
if countryCode != "" {
|
||||
return countryCode
|
||||
}
|
||||
|
||||
if user != nil && user.CountryCode != "" {
|
||||
return user.CountryCode
|
||||
}
|
||||
|
||||
if org := GetOrganizationByUser(user); org != nil && len(org.CountryCodes) > 0 {
|
||||
return org.CountryCodes[0]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
Reference in New Issue
Block a user