mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-30 10:28:42 +00:00
feat: add captcha (#2613)
* feat: captcha * add borderRadius * code perf
This commit is contained in:
@@ -15,6 +15,7 @@ export const sendAuthCode = (data: {
|
||||
username: string;
|
||||
type: `${UserAuthTypeEnum}`;
|
||||
googleToken: string;
|
||||
captcha: string;
|
||||
}) => POST(`/proApi/support/user/inform/sendAuthCode`, data);
|
||||
|
||||
export const getTokenLogin = () =>
|
||||
@@ -82,3 +83,8 @@ export const getWXLoginQR = () =>
|
||||
|
||||
export const getWXLoginResult = (code: string) =>
|
||||
GET<ResLogin>(`/proApi/support/user/account/login/wx/getResult`, { code });
|
||||
|
||||
export const getCaptchaPic = (username: string) =>
|
||||
GET<{
|
||||
captchaImage: string;
|
||||
}>('/proApi/support/user/account/captcha', { username });
|
||||
|
@@ -12,10 +12,18 @@ export const useSendCode = () => {
|
||||
const [codeCountDown, setCodeCountDown] = useState(0);
|
||||
|
||||
const { runAsync: sendCode, loading: codeSending } = useRequest2(
|
||||
async ({ username, type }: { username: string; type: `${UserAuthTypeEnum}` }) => {
|
||||
async ({
|
||||
username,
|
||||
type,
|
||||
captcha
|
||||
}: {
|
||||
username: string;
|
||||
type: `${UserAuthTypeEnum}`;
|
||||
captcha: string;
|
||||
}) => {
|
||||
if (codeCountDown > 0) return;
|
||||
const googleToken = await getClientToken(feConfigs.googleClientVerKey);
|
||||
await sendAuthCode({ username, type, googleToken });
|
||||
await sendAuthCode({ username, type, googleToken, captcha });
|
||||
setCodeCountDown(60);
|
||||
|
||||
timer = setInterval(() => {
|
||||
|
Reference in New Issue
Block a user