mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-22 18:25:47 +08:00
Fix bug in payment.
This commit is contained in:
parent
20fc7d1b58
commit
e5c1f560c5
2
main.go
2
main.go
@ -31,7 +31,7 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
createDatabase := flag.Bool("createDatabase", false, "true if you need casdoor to create database")
|
||||
createDatabase := flag.Bool("createDatabase", false, "true if you need Casdoor to create database")
|
||||
flag.Parse()
|
||||
|
||||
object.InitAdapter(*createDatabase)
|
||||
|
@ -65,12 +65,6 @@ class PaymentEditPage extends React.Component {
|
||||
}
|
||||
|
||||
issueInvoice() {
|
||||
const errorText = this.checkError();
|
||||
if (errorText !== "") {
|
||||
Setting.showMessage("error", errorText);
|
||||
return;
|
||||
}
|
||||
|
||||
alert("111")
|
||||
}
|
||||
|
||||
@ -80,7 +74,7 @@ class PaymentEditPage extends React.Component {
|
||||
|
||||
renderModal() {
|
||||
const ths = this;
|
||||
const handleChangeMyTag = () => {
|
||||
const handleIssueInvoice = () => {
|
||||
ths.issueInvoice();
|
||||
};
|
||||
|
||||
@ -98,7 +92,7 @@ class PaymentEditPage extends React.Component {
|
||||
</div>
|
||||
}
|
||||
visible={this.state.isModalVisible}
|
||||
onOk={handleChangeMyTag}
|
||||
onOk={handleIssueInvoice}
|
||||
onCancel={handleCancel}
|
||||
okText={i18next.t("payment:Issue Invoice")}
|
||||
cancelText={i18next.t("general:Cancel")}>
|
||||
@ -346,6 +340,12 @@ class PaymentEditPage extends React.Component {
|
||||
{
|
||||
this.state.payment.invoiceUrl === "" ? (
|
||||
<Button type={"primary"} onClick={() => {
|
||||
const errorText = this.checkError();
|
||||
if (errorText !== "") {
|
||||
Setting.showMessage("error", errorText);
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
isModalVisible: true,
|
||||
});
|
||||
@ -390,7 +390,7 @@ class PaymentEditPage extends React.Component {
|
||||
return i18next.t("signup:The input is not invoice Tax ID!");
|
||||
}
|
||||
} else {
|
||||
if (this.state.payment.invoiceTitle === "" || !Setting.isValidInvoiceTitle(this.state.payment.invoiceTitle)) {
|
||||
if (!Setting.isValidInvoiceTitle(this.state.payment.invoiceTitle)) {
|
||||
return i18next.t("signup:The input is not invoice title!");
|
||||
}
|
||||
|
||||
|
@ -206,12 +206,20 @@ export function isValidEmail(email) {
|
||||
}
|
||||
|
||||
export function isValidPhone(phone) {
|
||||
if (phone === "") {
|
||||
return false;
|
||||
}
|
||||
|
||||
// https://learnku.com/articles/31543, `^s*$` filter empty email individually.
|
||||
const phoneRegex = /^\s*$|^1(3\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\d|9[0-35-9])\d{8}$/;
|
||||
return phoneRegex.test(phone);
|
||||
}
|
||||
|
||||
export function isValidInvoiceTitle(invoiceTitle) {
|
||||
if (invoiceTitle === "") {
|
||||
return false;
|
||||
}
|
||||
|
||||
// https://blog.css8.cn/post/14210975.html
|
||||
const invoiceTitleRegex = /^[\(\)\(\)\u4e00-\u9fa5]{0,50}$/;
|
||||
return invoiceTitleRegex.test(invoiceTitle);
|
||||
|
Loading…
x
Reference in New Issue
Block a user