mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 12:30:19 +08:00
feat: can send Aliyun test SMS now (#1651)
This commit is contained in:
@ -44,7 +44,7 @@ func SendSms(provider *Provider, content string, phoneNumbers ...string) error {
|
|||||||
|
|
||||||
if provider.Type == sender.Aliyun {
|
if provider.Type == sender.Aliyun {
|
||||||
for i, number := range phoneNumbers {
|
for i, number := range phoneNumbers {
|
||||||
phoneNumbers[i] = strings.TrimPrefix(number, "+")
|
phoneNumbers[i] = strings.TrimPrefix(number, "+86")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,6 @@ class LoginPage extends React.Component {
|
|||||||
username: null,
|
username: null,
|
||||||
validEmailOrPhone: false,
|
validEmailOrPhone: false,
|
||||||
validEmail: false,
|
validEmail: false,
|
||||||
validPhone: false,
|
|
||||||
loginMethod: "password",
|
loginMethod: "password",
|
||||||
enableCaptchaModal: false,
|
enableCaptchaModal: false,
|
||||||
openCaptchaModal: false,
|
openCaptchaModal: false,
|
||||||
@ -427,16 +426,15 @@ class LoginPage extends React.Component {
|
|||||||
{
|
{
|
||||||
validator: (_, value) => {
|
validator: (_, value) => {
|
||||||
if (this.state.loginMethod === "verificationCode") {
|
if (this.state.loginMethod === "verificationCode") {
|
||||||
if (!Setting.isValidEmail(this.state.username) && !Setting.isValidPhone(this.state.username)) {
|
if (!Setting.isValidEmail(value) && !Setting.isValidPhone(value)) {
|
||||||
this.setState({validEmailOrPhone: false});
|
this.setState({validEmailOrPhone: false});
|
||||||
return Promise.reject(i18next.t("login:The input is not valid Email or Phone!"));
|
return Promise.reject(i18next.t("login:The input is not valid Email or Phone!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Setting.isValidPhone(this.state.username)) {
|
if (Setting.isValidEmail(value)) {
|
||||||
this.setState({validPhone: true});
|
|
||||||
}
|
|
||||||
if (Setting.isValidEmail(this.state.username)) {
|
|
||||||
this.setState({validEmail: true});
|
this.setState({validEmail: true});
|
||||||
|
} else {
|
||||||
|
this.setState({validEmail: false});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user