Skip to content

Commit

Permalink
feat: remove recaptcha (#326)
Browse files Browse the repository at this point in the history
* feat: remove recaptcha

* fix: remove params
  • Loading branch information
634750802 committed Dec 6, 2021
1 parent c6f1e53 commit 14ef3ab
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 32 deletions.
1 change: 0 additions & 1 deletion packages/accounts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@
<body>
<div id="app" class="tidb-community-ui"></div>
<script type="module" src="/src/main.jsx"></script>
<script src="https://www.recaptcha.net/recaptcha/api.js?render=<%- RE_CAPTCHA_SITE_KEY %>"></script>
</body>
</html>
24 changes: 12 additions & 12 deletions packages/accounts/src/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export const phoneLoginCheck = async ({ phone }) => {
await client.post('/api/login/phone/check', { phone });
};

export const sendCode = async (path, { phone, re_token_v3 }) => {
await client.post(`/api/${path}/send-code`, { phone, re_token_v3 }).catch(handleSendCodeLimitError);
export const sendCode = async (path, { phone }) => {
await client.post(`/api/${path}/send-code`, { phone }).catch(handleSendCodeLimitError);
};

const postLogin = async ({ redirect_to, sso_callbacks }) => {
Expand All @@ -29,13 +29,13 @@ const postLogin = async ({ redirect_to, sso_callbacks }) => {
};
};

export const phoneLogin = async ({ phone, code, re_token_v3, redirect_to }) => {
const { data: resp } = await client.post('/api/login/phone', { phone, code, re_token_v3, redirect_to });
export const phoneLogin = async ({ phone, code, redirect_to }) => {
const { data: resp } = await client.post('/api/login/phone', { phone, code, redirect_to });
return postLogin(resp);
};

export const passwordLogin = async ({ identifier, password, re_token_v3, redirect_to }) => {
const { data: resp } = await client.post('/api/login/password', { identifier, password, re_token_v3, redirect_to });
export const passwordLogin = async ({ identifier, password, redirect_to }) => {
const { data: resp } = await client.post('/api/login/password', { identifier, password, redirect_to });
return postLogin(resp);
};

Expand All @@ -46,17 +46,17 @@ export const socialLogin = ({ provider, redirect_to }) => {
);
};

export const signup = async ({ company, email, phone, code, re_token_v3, redirect_to }) => {
const { data: resp } = await client.post('/api/signup', { company, email, phone, code, re_token_v3, redirect_to });
export const signup = async ({ company, email, phone, code, redirect_to }) => {
const { data: resp } = await client.post('/api/signup', { company, email, phone, code, redirect_to });
return postLogin(resp);
};

export const forgetSendCode = async ({ identifier, re_token_v3 }) => {
await client.post(`/api/forget/send-code`, { identifier, re_token_v3 }).catch(handleSendCodeLimitError);
export const forgetSendCode = async ({ identifier }) => {
await client.post(`/api/forget/send-code`, { identifier }).catch(handleSendCodeLimitError);
};

export const forgetVerifyCode = async ({ identifier, code, re_token_v3 }) => {
return client.post('/api/forget/verify', { identifier, code, re_token_v3 });
export const forgetVerifyCode = async ({ identifier, code }) => {
return client.post('/api/forget/verify', { identifier, code });
};

export const forgetResetPassword = async ({ new_password }) => {
Expand Down
1 change: 1 addition & 0 deletions packages/accounts/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export default ({ mode }) => {
alias: {
'@/public': resolve(__dirname, '../../public'),
'@': resolve(__dirname, '../../src'),
'@tidb-community/ui': resolve(__dirname, '../../packages/ui/es'),
'~': resolve(__dirname, 'src'),
...unifyNodeModules([
'antd',
Expand Down
18 changes: 6 additions & 12 deletions packages/datasource/src/api/account/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,35 @@ import client from '../client';

export const settings = () => client.get('/api/account/settings');

export const sendPhoneCode = ({ phone, re_token_v3 }) =>
export const sendPhoneCode = ({ phone }) =>
client.post('/api/account/set-phone/send-code', {
phone,
re_token_v3,
});

export const setPhone = ({ phone, code, re_token_v3 }) =>
export const setPhone = ({ phone, code }) =>
client.post('/api/account/set-phone', {
phone,
code,
re_token_v3,
});

export const sendEmailCode = ({ email, re_token_v3 }) =>
export const sendEmailCode = ({ email }) =>
client.post('/api/account/set-email/send-code', {
email,
re_token_v3,
});

export const setEmail = ({ email, code, re_token_v3 }) =>
export const setEmail = ({ email, code }) =>
client.post('/api/account/set-email', {
email,
code,
re_token_v3,
});

export const setPassword = ({ new_password, re_token_v3 }) =>
export const setPassword = ({ new_password }) =>
client.post('/api/account/set-password', {
new_password,
re_token_v3,
});

export const resetPassword = ({ old_password, new_password, re_token_v3 }) =>
export const resetPassword = ({ old_password, new_password }) =>
client.post('/api/account/reset-password', {
old_password,
new_password,
re_token_v3,
});
7 changes: 0 additions & 7 deletions src/pages/my/layout/Layout.component.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import NextHead from 'next/head';
import React, { useEffect, useContext } from 'react';
import { Col, Row } from 'antd';

Expand All @@ -17,12 +16,6 @@ const Layout = ({ children, title }) => {

return (
<>
<NextHead>
{process.env.NEXT_PUBLIC_RECAPTCHA_KEY && (
<script src={`https://www.recaptcha.net/recaptcha/api.js?render=${process.env.NEXT_PUBLIC_RECAPTCHA_KEY}`} />
)}
</NextHead>

<CoreLayout hasMargin>
<Styled.Container>
<Row gutter={[32, 32]}>
Expand Down

1 comment on commit 14ef3ab

@vercel
Copy link

@vercel vercel bot commented on 14ef3ab Dec 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.