mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-05 22:20:01 +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:
@ -29,6 +29,7 @@ import SelectRegionBox from "./SelectRegionBox";
|
||||
import WebAuthnCredentialTable from "./WebauthnCredentialTable";
|
||||
import ManagedAccountTable from "./ManagedAccountTable";
|
||||
import PropertyTable from "./propertyTable";
|
||||
import PhoneNumberInput from "./common/PhoneNumberInput";
|
||||
|
||||
const {Option} = Select;
|
||||
|
||||
@ -286,11 +287,13 @@ class UserEditPage extends React.Component {
|
||||
<Col style={{paddingRight: "20px"}} span={11} >
|
||||
{Setting.isLocalAdminUser(this.props.account) ?
|
||||
(<Input value={this.state.user.email}
|
||||
style={{width: "280Px"}}
|
||||
disabled={disabled}
|
||||
onChange={e => {
|
||||
this.updateUserField("email", e.target.value);
|
||||
}} />) :
|
||||
(<Select virtual={false} value={this.state.user.email}
|
||||
style={{width: "280Px"}}
|
||||
options={[Setting.getItem(this.state.user.email, this.state.user.email)]}
|
||||
disabled={disabled}
|
||||
onChange={e => {
|
||||
@ -298,7 +301,7 @@ class UserEditPage extends React.Component {
|
||||
}} />)
|
||||
}
|
||||
</Col>
|
||||
<Col span={11} >
|
||||
<Col span={Setting.isMobile() ? 22 : 11} >
|
||||
{/* backend auto get the current user, so admin can not edit. Just self can reset*/}
|
||||
{this.isSelf() ? <ResetModal application={this.state.application} disabled={disabled} buttonText={i18next.t("user:Reset Email...")} destType={"email"} /> : null}
|
||||
</Col>
|
||||
@ -307,24 +310,37 @@ class UserEditPage extends React.Component {
|
||||
} else if (accountItem.name === "Phone") {
|
||||
return (
|
||||
<Row style={{marginTop: "20px"}} >
|
||||
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 22 : 2}>
|
||||
<Col style={{marginTop: "5px"}} span={Setting.isMobile() ? 22 : 2}>
|
||||
{Setting.getLabel(i18next.t("general:Phone"), i18next.t("general:Phone - Tooltip"))} :
|
||||
</Col>
|
||||
<Col style={{paddingRight: "20px"}} span={11} >
|
||||
{Setting.isLocalAdminUser(this.props.account) ?
|
||||
<Input value={this.state.user.phone} addonBefore={`+${this.state.application?.organizationObj.phonePrefix}`}
|
||||
disabled={disabled}
|
||||
onChange={e => {
|
||||
this.updateUserField("phone", e.target.value);
|
||||
}} /> :
|
||||
(<Select virtual={false} value={`+${this.state.application?.organizationObj.phonePrefix} ${this.state.user.phone}`}
|
||||
options={[Setting.getItem(`+${this.state.application?.organizationObj.phonePrefix} ${this.state.user.phone}`, this.state.user.phone)]}
|
||||
<Input.Group compact style={{width: "280Px"}}>
|
||||
<PhoneNumberInput
|
||||
style={{width: "30%"}}
|
||||
value={this.state.user.countryCode}
|
||||
onChange={(value) => {
|
||||
this.updateUserField("countryCode", value);
|
||||
}}
|
||||
countryCodes={this.state.application?.organizationObj.countryCodes}
|
||||
/>
|
||||
<Input value={this.state.user.phone}
|
||||
style={{width: "70%"}}
|
||||
disabled={disabled}
|
||||
onChange={e => {
|
||||
this.updateUserField("phone", e.target.value);
|
||||
}} />
|
||||
</Input.Group>
|
||||
:
|
||||
(<Select virtual={false} value={this.state.user.phone === "" ? null : `+${Setting.getPhoneCodeFromCountryCode(this.state.user.countryCode)} ${this.state.user.phone}`}
|
||||
options={this.state.user.phone === "" ? null : [Setting.getItem(`+${Setting.getPhoneCodeFromCountryCode(this.state.user.countryCode)} ${this.state.user.phone}`, this.state.user.phone)]}
|
||||
disabled={disabled}
|
||||
style={{width: "280px"}}
|
||||
onChange={e => {
|
||||
this.updateUserField("phone", e.target.value);
|
||||
}} />)}
|
||||
</Col>
|
||||
<Col span={11} >
|
||||
<Col span={Setting.isMobile() ? 24 : 11} >
|
||||
{this.isSelf() ? (<ResetModal application={this.state.application} disabled={disabled} buttonText={i18next.t("user:Reset Phone...")} destType={"phone"} />) : null}
|
||||
</Col>
|
||||
</Row>
|
||||
|
Reference in New Issue
Block a user