mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-24 08:20:31 +08:00
feat: support "All" in organization's country codes (#3264)
This commit is contained in:
parent
e1dea9f697
commit
468631e654
@ -51,6 +51,9 @@ func IsPhoneValid(phone string, countryCode string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func IsPhoneAllowInRegin(countryCode string, allowRegions []string) bool {
|
func IsPhoneAllowInRegin(countryCode string, allowRegions []string) bool {
|
||||||
|
if ContainsString(allowRegions, "All") {
|
||||||
|
return true
|
||||||
|
}
|
||||||
return ContainsString(allowRegions, countryCode)
|
return ContainsString(allowRegions, countryCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,6 +350,7 @@ class OrganizationEditPage extends React.Component {
|
|||||||
}}
|
}}
|
||||||
filterOption={(input, option) => (option?.text ?? "").toLowerCase().includes(input.toLowerCase())}
|
filterOption={(input, option) => (option?.text ?? "").toLowerCase().includes(input.toLowerCase())}
|
||||||
>
|
>
|
||||||
|
{Setting.getCountryCodeOption({name: i18next.t("organization:All"), code: "All", phone: 0})}
|
||||||
{
|
{
|
||||||
Setting.getCountryCodeData().map((country) => Setting.getCountryCodeOption(country))
|
Setting.getCountryCodeData().map((country) => Setting.getCountryCodeOption(country))
|
||||||
}
|
}
|
||||||
|
@ -418,6 +418,9 @@ export function getCountryCode(country) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getCountryCodeData(countryCodes = phoneNumber.getCountries()) {
|
export function getCountryCodeData(countryCodes = phoneNumber.getCountries()) {
|
||||||
|
if (countryCodes?.includes("All")) {
|
||||||
|
countryCodes = phoneNumber.getCountries();
|
||||||
|
}
|
||||||
return countryCodes?.map((countryCode) => {
|
return countryCodes?.map((countryCode) => {
|
||||||
if (phoneNumber.isSupportedCountry(countryCode)) {
|
if (phoneNumber.isSupportedCountry(countryCode)) {
|
||||||
const name = initCountries().getName(countryCode, getLanguage());
|
const name = initCountries().getName(countryCode, getLanguage());
|
||||||
@ -436,10 +439,10 @@ export function getCountryCodeOption(country) {
|
|||||||
<Option key={country.code} value={country.code} label={`+${country.phone}`} text={`${country.name}, ${country.code}, ${country.phone}`} >
|
<Option key={country.code} value={country.code} label={`+${country.phone}`} text={`${country.name}, ${country.code}, ${country.phone}`} >
|
||||||
<div style={{display: "flex", justifyContent: "space-between", marginRight: "10px"}}>
|
<div style={{display: "flex", justifyContent: "space-between", marginRight: "10px"}}>
|
||||||
<div>
|
<div>
|
||||||
{getCountryImage(country)}
|
{country.code === "All" ? null : getCountryImage(country)}
|
||||||
{`${country.name}`}
|
{`${country.name}`}
|
||||||
</div>
|
</div>
|
||||||
{`+${country.phone}`}
|
{country.code === "All" ? null : `+${country.phone}`}
|
||||||
</div>
|
</div>
|
||||||
</Option>
|
</Option>
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user