mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 20:50:19 +08:00
feat: login by code (#344)
Signed-off-by: abingcbc <abingcbc626@gmail.com>
This commit is contained in:
@ -18,6 +18,8 @@ import * as Setting from "../Setting";
|
||||
import i18next from "i18next";
|
||||
import * as UserBackend from "../backend/UserBackend";
|
||||
import {SafetyOutlined} from "@ant-design/icons";
|
||||
import * as Util from "../auth/Util";
|
||||
import {isValidEmail, isValidPhone} from "../Setting";
|
||||
|
||||
const { Search } = Input;
|
||||
|
||||
@ -40,6 +42,14 @@ export const CountDownInput = (props) => {
|
||||
|
||||
const handleOk = () => {
|
||||
setVisible(false);
|
||||
if (isValidEmail(onButtonClickArgs[0])) {
|
||||
onButtonClickArgs[1] = "email";
|
||||
} else if (isValidPhone(onButtonClickArgs[0])) {
|
||||
onButtonClickArgs[1] = "phone";
|
||||
} else {
|
||||
Util.showMessage("error", i18next.t("login:Invalid Email or phone"))
|
||||
return;
|
||||
}
|
||||
UserBackend.sendCode(checkType, checkId, key, ...onButtonClickArgs).then(res => {
|
||||
setKey("");
|
||||
if (res) {
|
||||
|
Reference in New Issue
Block a user