feat: move User.PhonePrefix to Organization.PhonePrefix

Signed-off-by: Kininaru <shiftregister233@outlook.com>
This commit is contained in:
Kininaru
2021-05-13 09:39:07 +08:00
parent 827930a020
commit 892cb39e3e
11 changed files with 63 additions and 35 deletions

View File

@ -149,6 +149,16 @@ class OrganizationEditPage extends React.Component {
}} />
</Col>
</Row>
<Row style={{marginTop: '20px'}} >
<Col style={{marginTop: '5px'}} span={2}>
{i18next.t("general:Phone Prefix")}:
</Col>
<Col span={22} >
<Input addonBefore={"+"} value={this.state.organization.phonePrefix} onChange={e => {
this.updateOrganizationField('phonePrefix', e.target.value);
}} />
</Col>
</Row>
</Card>
)
}

View File

@ -37,7 +37,7 @@ export const ResetModal = (props) => {
let dest = document.getElementById("dest").value;
let code = document.getElementById("code").value;
if (dest === "") {
Setting.showMessage("error", i18next.t("user:Empty ") + destType);
Setting.showMessage("error", i18next.t("user:Empty " + destType));
return;
}
if (code === "") {
@ -70,7 +70,7 @@ export const ResetModal = (props) => {
if (sendCodeCoolDown) return;
let dest = document.getElementById("dest").value;
if (dest === "") {
Setting.showMessage("error", i18next.t("user:Empty ") + destType);
Setting.showMessage("error", i18next.t("user:Empty " + destType));
return;
}
UserBackend.sendCode(dest, destType).then(res => {
@ -86,7 +86,7 @@ export const ResetModal = (props) => {
let placeHolder = "";
if (destType === "email") placeHolder = i18next.t("user:Input your email");
else if (destType === "phone") placeHolder = i18next.t("user:Phone prefix is needed");
else if (destType === "phone") placeHolder = i18next.t("user:Input your phone number");
return (
<Row>

View File

@ -285,7 +285,7 @@ class UserEditPage extends React.Component {
{i18next.t("general:Phone")}:
</Col>
<Col span={22} >
<Input value={"+" + this.state.user.phonePrefix + this.state.user.phone} disabled/>
<Input value={this.state.user.phone} disabled/>
{ this.state.user.id === this.props.account.id ? (<ResetModal buttonText={i18next.t("user:Reset Phone")} destType={"phone"} coolDownTime={60}/>) : null}
</Col>
</Row>

View File

@ -52,7 +52,6 @@ class UserListPage extends React.Component {
displayName: `New User - ${this.state.users.length}`,
avatar: "https://casbin.org/img/casbin.svg",
email: "user@example.com",
phonePrefix: "86",
phone: "12345678",
affiliation: "Example Inc.",
tag: "staff",

View File

@ -133,19 +133,6 @@ class SignupPage extends React.Component {
)
}
const prefixSelector = (
<Form.Item name="phonePrefix" noStyle>
<Select
style={{
width: 80,
}}
>
<Option value="1">+1</Option>
<Option value="86">+86</Option>
</Select>
</Form.Item>
);
return (
<Form
{...formItemLayout}
@ -156,7 +143,6 @@ class SignupPage extends React.Component {
initialValues={{
application: application.name,
organization: application.organization,
phonePrefix: '86',
}}
style={{width: !Setting.isMobile() ? "400px" : "250px"}}
size="large"
@ -285,7 +271,6 @@ class SignupPage extends React.Component {
]}
>
<Input
addonBefore={prefixSelector}
style={{
width: '100%',
}}

View File

@ -29,7 +29,8 @@
"Users under all organizations": "Users under all organizations",
"OAuth providers": "OAuth providers",
"Applications that requires authentication": "Applications that requires authentication",
"Swagger": "Swagger"
"Swagger": "Swagger",
"Phone Prefix": "Phone Prefix"
},
"signup":
{
@ -126,7 +127,7 @@
"email reset": "Email Reset",
"Code Sent": "Code Sent",
"Input your email": "Input your email",
"Phone prefix is needed": "Phone prefix is needed",
"Input your phone number": "Input your phone number",
"New phone": "New Phone",
"New email": "New Email",
"Code You Received": "Code You Received",

View File

@ -29,7 +29,8 @@
"Users under all organizations": "所有组织里的用户",
"OAuth providers": "OAuth提供方",
"Applications that requires authentication": "需要鉴权的应用",
"Swagger": "API总览"
"Swagger": "API总览",
"Phone Prefix": "电话前缀"
},
"signup":
{
@ -128,7 +129,7 @@
"email reset": "邮箱已设置",
"Code Sent": "验证码已发送",
"Input your email": "请输入邮箱",
"Phone prefix is needed": "记得输入地区前缀(+86",
"Input your phone number": "输入电话号码",
"New phone": "新的电话号",
"New email": "新的邮箱",
"Code You Received": "你收到的验证码",