mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-04 05:10:19 +08:00
feat: fix bug that signup country code is undefined (#1590)
* feat: fix signup country code is undefined * refactor: valid phone number in CN
This commit is contained in:
@ -16,9 +16,8 @@ import {Select} from "antd";
|
||||
import * as Setting from "../Setting";
|
||||
import React from "react";
|
||||
|
||||
export default function PhoneNumberInput(props) {
|
||||
const {onChange, style, disabled} = props;
|
||||
const value = props.value ?? "CN";
|
||||
export const PhoneNumberInput = (props) => {
|
||||
const {onChange, style, disabled, countryCode} = props;
|
||||
const countryCodes = props.countryCodes ?? [];
|
||||
|
||||
const handleOnChange = (e) => {
|
||||
@ -31,7 +30,7 @@ export default function PhoneNumberInput(props) {
|
||||
showSearch
|
||||
style={style}
|
||||
disabled={disabled}
|
||||
value={value}
|
||||
value={countryCode}
|
||||
dropdownMatchSelectWidth={false}
|
||||
optionLabelProp={"label"}
|
||||
onChange={handleOnChange}
|
||||
@ -42,4 +41,4 @@ export default function PhoneNumberInput(props) {
|
||||
}
|
||||
</Select>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
@ -22,7 +22,7 @@ import {CaptchaWidget} from "./CaptchaWidget";
|
||||
const {Search} = Input;
|
||||
|
||||
export const SendCodeInput = (props) => {
|
||||
const {disabled, textBefore, onChange, onButtonClickArgs, application, method} = props;
|
||||
const {disabled, textBefore, onChange, onButtonClickArgs, application, method, countryCode} = props;
|
||||
const [visible, setVisible] = React.useState(false);
|
||||
const [key, setKey] = React.useState("");
|
||||
const [captchaImg, setCaptchaImg] = React.useState("");
|
||||
@ -53,7 +53,7 @@ export const SendCodeInput = (props) => {
|
||||
const handleOk = () => {
|
||||
setVisible(false);
|
||||
setButtonLoading(true);
|
||||
UserBackend.sendCode(checkType, checkId, key, method, ...onButtonClickArgs).then(res => {
|
||||
UserBackend.sendCode(checkType, checkId, key, method, countryCode, ...onButtonClickArgs).then(res => {
|
||||
setKey("");
|
||||
setButtonLoading(false);
|
||||
if (res) {
|
||||
@ -70,7 +70,7 @@ export const SendCodeInput = (props) => {
|
||||
const loadCaptcha = () => {
|
||||
UserBackend.getCaptcha(application.owner, application.name, false).then(res => {
|
||||
if (res.type === "none") {
|
||||
UserBackend.sendCode("none", "", "", method, ...onButtonClickArgs).then(res => {
|
||||
UserBackend.sendCode("none", "", "", method, countryCode, ...onButtonClickArgs).then(res => {
|
||||
if (res) {
|
||||
handleCountDown(60);
|
||||
}
|
||||
|
Reference in New Issue
Block a user