mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-24 08:20:31 +08:00
fix resetting phone bug
This commit is contained in:
parent
181e7c8c7d
commit
f5672357e6
@ -449,7 +449,7 @@ func UpdateUser(id string, user *User, columns []string, isGlobalAdmin bool) boo
|
||||
if len(columns) == 0 {
|
||||
columns = []string{
|
||||
"owner", "display_name", "avatar",
|
||||
"location", "address", "region", "language", "affiliation", "title", "homepage", "bio", "score", "tag", "signup_application",
|
||||
"location", "address", "country_code", "region", "language", "affiliation", "title", "homepage", "bio", "score", "tag", "signup_application",
|
||||
"is_admin", "is_global_admin", "is_forbidden", "is_deleted", "hash", "is_default_avatar", "properties", "webauthnCredentials", "managedAccounts",
|
||||
"signin_wrong_times", "last_signin_wrong_time",
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ class OrganizationEditPage extends React.Component {
|
||||
</Row>
|
||||
<Row style={{marginTop: "20px"}} >
|
||||
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 22 : 2}>
|
||||
{Setting.getLabel(i18next.t("general:Supported country code"), i18next.t("general:Supported country code - Tooltip"))} :
|
||||
{Setting.getLabel(i18next.t("general:Supported country codes"), i18next.t("general:Supported country codes - Tooltip"))} :
|
||||
</Col>
|
||||
<Col span={22} >
|
||||
<Select virtual={false} mode={"multiple"} style={{width: "100%"}} value={this.state.organization.countryCodes ?? []}
|
||||
|
@ -25,7 +25,7 @@ export const ResetModal = (props) => {
|
||||
const [confirmLoading, setConfirmLoading] = React.useState(false);
|
||||
const [dest, setDest] = React.useState("");
|
||||
const [code, setCode] = React.useState("");
|
||||
const {buttonText, destType, application} = props;
|
||||
const {buttonText, destType, application, account} = props;
|
||||
|
||||
const showModal = () => {
|
||||
setVisible(true);
|
||||
@ -87,7 +87,7 @@ export const ResetModal = (props) => {
|
||||
<Row style={{width: "100%", marginBottom: "20px"}}>
|
||||
<Input
|
||||
addonBefore={destType === "email" ? i18next.t("user:New Email") : i18next.t("user:New phone")}
|
||||
prefix={destType === "email" ? <MailOutlined /> : <PhoneOutlined />}
|
||||
prefix={destType === "email" ? <React.Fragment><MailOutlined /> </React.Fragment> : (<React.Fragment><PhoneOutlined /> {`+${Setting.getCountryCode(account.countryCode)}`} </React.Fragment>)}
|
||||
placeholder={placeholder}
|
||||
onChange={e => setDest(e.target.value)}
|
||||
/>
|
||||
|
@ -208,6 +208,10 @@ export function initCountries() {
|
||||
return countries;
|
||||
}
|
||||
|
||||
export function getCountryCode(country) {
|
||||
return phoneNumber.getCountryCallingCode(country);
|
||||
}
|
||||
|
||||
export function getCountryCodeData(countryCodes = phoneNumber.getCountries()) {
|
||||
return countryCodes?.map((countryCode) => {
|
||||
if (phoneNumber.isSupportedCountry(countryCode)) {
|
||||
|
@ -296,7 +296,7 @@ class UserEditPage extends React.Component {
|
||||
</Col>
|
||||
<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}
|
||||
{this.isSelf() ? <ResetModal application={this.state.application} account={this.props.account} disabled={disabled} buttonText={i18next.t("user:Reset Email...")} destType={"email"} /> : null}
|
||||
</Col>
|
||||
</Row>
|
||||
);
|
||||
@ -310,7 +310,7 @@ class UserEditPage extends React.Component {
|
||||
<Input.Group compact style={{width: "280Px"}}>
|
||||
<PhoneNumberInput
|
||||
style={{width: "30%"}}
|
||||
disabled={!Setting.isLocalAdminUser(this.props.account) ? true : disabled}
|
||||
// disabled={!Setting.isLocalAdminUser(this.props.account) ? true : disabled}
|
||||
value={this.state.user.countryCode}
|
||||
onChange={(value) => {
|
||||
this.updateUserField("countryCode", value);
|
||||
@ -326,7 +326,7 @@ class UserEditPage extends React.Component {
|
||||
</Input.Group>
|
||||
</Col>
|
||||
<Col span={Setting.isMobile() ? 24 : 11} >
|
||||
{this.isSelf() ? (<ResetModal application={this.state.application} disabled={disabled} buttonText={i18next.t("user:Reset Phone...")} destType={"phone"} />) : null}
|
||||
{this.isSelf() ? (<ResetModal application={this.state.application} account={this.props.account} disabled={disabled} buttonText={i18next.t("user:Reset Phone...")} destType={"phone"} />) : null}
|
||||
</Col>
|
||||
</Row>
|
||||
);
|
||||
|
@ -251,8 +251,8 @@
|
||||
"Successfully added": "Successfully added",
|
||||
"Successfully deleted": "Successfully deleted",
|
||||
"Successfully saved": "Successfully saved",
|
||||
"Supported country code": "Supported country code",
|
||||
"Supported country code - Tooltip": "Supported country code - Tooltip",
|
||||
"Supported country codes": "Supported country codes",
|
||||
"Supported country codes - Tooltip": "Supported country codes - Tooltip",
|
||||
"Swagger": "Swagger",
|
||||
"Sync": "Sync",
|
||||
"Syncers": "Syncers",
|
||||
|
@ -251,8 +251,8 @@
|
||||
"Successfully added": "Successfully added",
|
||||
"Successfully deleted": "Successfully deleted",
|
||||
"Successfully saved": "Successfully saved",
|
||||
"Supported country code": "Supported country code",
|
||||
"Supported country code - Tooltip": "Supported country code - Tooltip",
|
||||
"Supported country codes": "Supported country codes",
|
||||
"Supported country codes - Tooltip": "Supported country codes - Tooltip",
|
||||
"Swagger": "Swagger",
|
||||
"Sync": "Sync",
|
||||
"Syncers": "Syncers",
|
||||
|
@ -251,8 +251,8 @@
|
||||
"Successfully added": "Successfully added",
|
||||
"Successfully deleted": "Successfully deleted",
|
||||
"Successfully saved": "Successfully saved",
|
||||
"Supported country code": "Supported country code",
|
||||
"Supported country code - Tooltip": "Supported country code - Tooltip",
|
||||
"Supported country codes": "Supported country codes",
|
||||
"Supported country codes - Tooltip": "Supported country codes - Tooltip",
|
||||
"Swagger": "Swagger",
|
||||
"Sync": "Sincronizador",
|
||||
"Syncers": "Sincronizadores",
|
||||
|
@ -251,8 +251,8 @@
|
||||
"Successfully added": "Successfully added",
|
||||
"Successfully deleted": "Successfully deleted",
|
||||
"Successfully saved": "Successfully saved",
|
||||
"Supported country code": "Supported country code",
|
||||
"Supported country code - Tooltip": "Supported country code - Tooltip",
|
||||
"Supported country codes": "Supported country codes",
|
||||
"Supported country codes - Tooltip": "Supported country codes - Tooltip",
|
||||
"Swagger": "Swagger",
|
||||
"Sync": "Sync",
|
||||
"Syncers": "Synchronisateurs",
|
||||
|
@ -251,8 +251,8 @@
|
||||
"Successfully added": "Successfully added",
|
||||
"Successfully deleted": "Successfully deleted",
|
||||
"Successfully saved": "Successfully saved",
|
||||
"Supported country code": "Supported country code",
|
||||
"Supported country code - Tooltip": "Supported country code - Tooltip",
|
||||
"Supported country codes": "Supported country codes",
|
||||
"Supported country codes - Tooltip": "Supported country codes - Tooltip",
|
||||
"Swagger": "Swagger",
|
||||
"Sync": "Sync",
|
||||
"Syncers": "Syncers",
|
||||
|
@ -251,8 +251,8 @@
|
||||
"Successfully added": "Successfully added",
|
||||
"Successfully deleted": "Successfully deleted",
|
||||
"Successfully saved": "Successfully saved",
|
||||
"Supported country code": "Supported country code",
|
||||
"Supported country code - Tooltip": "Supported country code - Tooltip",
|
||||
"Supported country codes": "Supported country codes",
|
||||
"Supported country codes - Tooltip": "Supported country codes - Tooltip",
|
||||
"Swagger": "Swagger",
|
||||
"Sync": "Sync",
|
||||
"Syncers": "Syncers",
|
||||
|
@ -251,8 +251,8 @@
|
||||
"Successfully added": "Successfully added",
|
||||
"Successfully deleted": "Successfully deleted",
|
||||
"Successfully saved": "Successfully saved",
|
||||
"Supported country code": "Supported country code",
|
||||
"Supported country code - Tooltip": "Supported country code - Tooltip",
|
||||
"Supported country codes": "Supported country codes",
|
||||
"Supported country codes - Tooltip": "Supported country codes - Tooltip",
|
||||
"Swagger": "Swagger",
|
||||
"Sync": "Sync",
|
||||
"Syncers": "Синхронизаторы",
|
||||
|
@ -251,8 +251,8 @@
|
||||
"Successfully added": "Successfully added",
|
||||
"Successfully deleted": "Successfully deleted",
|
||||
"Successfully saved": "Successfully saved",
|
||||
"Supported country code": "Supported country code",
|
||||
"Supported country code - Tooltip": "Supported country code - Tooltip",
|
||||
"Supported country codes": "Supported country codes",
|
||||
"Supported country codes - Tooltip": "Supported country codes - Tooltip",
|
||||
"Swagger": "Swagger",
|
||||
"Sync": "Sync",
|
||||
"Syncers": "Syncers",
|
||||
|
@ -251,8 +251,8 @@
|
||||
"Successfully added": "添加成功",
|
||||
"Successfully deleted": "删除成功",
|
||||
"Successfully saved": "保存成功",
|
||||
"Supported country code": "支持的国家代码",
|
||||
"Supported country code - Tooltip": "支持发送短信的国家 - Tooltip",
|
||||
"Supported country codes": "支持的国家代码",
|
||||
"Supported country codes - Tooltip": "支持发送短信的国家 - Tooltip",
|
||||
"Swagger": "API文档",
|
||||
"Sync": "同步",
|
||||
"Syncers": "同步器",
|
||||
|
Loading…
x
Reference in New Issue
Block a user