diff --git a/artillery/rctf.yml b/artillery/rctf.yml index 8c70a078f..a6b744a60 100644 --- a/artillery/rctf.yml +++ b/artillery/rctf.yml @@ -41,10 +41,3 @@ scenarios: url: "/api/v1/users/me" headers: Authorization: "Bearer {{ token }}" - - delete: - url: "/api/v1/users/me" - headers: - Authorization: "Bearer {{ token }}" - - - diff --git a/client/src/api/profile.js b/client/src/api/profile.js index 75d052d60..75fd01b10 100644 --- a/client/src/api/profile.js +++ b/client/src/api/profile.js @@ -1,4 +1,4 @@ -import { request, relog, handleResponse } from './util' +import { request, handleResponse } from './util' export const privateProfile = async () => { const resp = await request('GET', '/users/me') @@ -12,19 +12,6 @@ export const publicProfile = async (uuid) => { return handleResponse({ resp, valid: ['goodUserData'] }) } -export const deleteAccount = async () => { - const resp = await request('DELETE', '/users/me') - - switch (resp.kind) { - case 'goodUserDelete': - return relog() - default: - return { - error: resp.message - } - } -} - export const updateAccount = async ({ name, division }) => { const resp = await request('PATCH', '/users/me', { name, diff --git a/client/src/routes/profile.js b/client/src/routes/profile.js index 0d4f14bec..3b24b382b 100644 --- a/client/src/routes/profile.js +++ b/client/src/routes/profile.js @@ -3,10 +3,9 @@ import { memo } from 'preact/compat' import config from '../config' import withStyles from '../components/jss' -import { privateProfile, publicProfile, deleteAccount, updateAccount, updateEmail, deleteEmail } from '../api/profile' +import { privateProfile, publicProfile, updateAccount, updateEmail, deleteEmail } from '../api/profile' import { useToast } from '../components/toast' import Form from '../components/form' -import Modal from '../components/modal' import MembersCard from '../components/profile/memberscard' import TokenPreview from '../components/tokenPreview' import * as util from '../util' @@ -23,66 +22,6 @@ for (const division of Object.entries(config.divisions)) { divisionMap.set(division[1], division[0]) } -const DeleteModal = withStyles({ - modalBody: { - paddingTop: '0em !important' // reduce space between header and body - }, - controls: { - display: 'flex', - justifyContent: 'center', - '& :first-child': { - marginLeft: '0em' - }, - '& :last-child': { - marginRight: '0em' - } - } -}, ({ open, onClose, onSuccess, teamName, classes }) => { - const [inputName, setInputName] = useState('') - const handleInputNameChange = useCallback((e) => setInputName(e.target.value), []) - const isNameValid = inputName === teamName - const verifyName = useCallback((e) => { - e.preventDefault() - if (isNameValid) { - onSuccess() - } - }, [isNameValid, onSuccess]) - const wrappedOnClose = useCallback((e) => { - e.preventDefault() - onClose() - }, [onClose]) - - useEffect(() => { - if (!open) { - setInputName('') - } - }, [open]) - - return ( - - - {/* Put buttons in the body because otherwise there is too much padding */} -
-
Are you sure you want to delete your team? This action is permanent.
-
- - -
-
-
- -
-
- -
-
-
-
- ) -}) - const SummaryCard = memo(withStyles({ icon: { '& svg': { @@ -208,10 +147,6 @@ const UpdateCard = withStyles({ }, ({ name: oldName, email: oldEmail, onUpdate, classes }) => { const { toast } = useToast() - const [deleteModalVisible, setDeleteModalVisible] = useState(false) - const dismissDeleteModal = useCallback(() => setDeleteModalVisible(false), []) - const handleDelete = useCallback(() => setDeleteModalVisible(true), []) - const [name, setName] = useState(oldName) const handleSetName = useCallback((e) => setName(e.target.value), []) @@ -293,10 +228,6 @@ const UpdateCard = withStyles({ } name='email' placeholder='Email' type='email' value={email} onChange={handleSetEmail} /> -
- - -
) diff --git a/server/api/users/delete.js b/server/api/users/delete.js deleted file mode 100644 index 59e26a57a..000000000 --- a/server/api/users/delete.js +++ /dev/null @@ -1,16 +0,0 @@ -import { responses } from '../../responses' -import * as database from '../../database' - -export default { - method: 'delete', - path: '/users/me', - requireAuth: true, - handler: async ({ user }) => { - const uuid = user.id - await database.auth.removeUserById({ - id: uuid - }) - - return responses.goodUserDelete - } -} diff --git a/server/api/users/index.js b/server/api/users/index.js index cb9f291b9..ea38434ef 100644 --- a/server/api/users/index.js +++ b/server/api/users/index.js @@ -7,7 +7,6 @@ export default [ ...require('./members').default, require('./me').default, require('./id').default, - require('./delete').default, require('./update').default, ...require('./me-auth/ctftime').default, ...require('./me-auth/email').default diff --git a/server/responses/index.js b/server/responses/index.js index a7b287f32..d18417cc5 100644 --- a/server/responses/index.js +++ b/server/responses/index.js @@ -155,10 +155,6 @@ export const responseList = { status: 200, message: 'The user data was successfully retrieved.' }, - goodUserDelete: { - status: 200, - message: 'Your account was successfully deleted' - }, goodUserUpdate: { status: 200, message: 'Your account was successfully updated' diff --git a/server/util/emails/verify.txt b/server/util/emails/verify.txt index 5a3a57c2e..19935b582 100644 --- a/server/util/emails/verify.txt +++ b/server/util/emails/verify.txt @@ -14,7 +14,7 @@ To verify your email and recover your {{{ ctf_name }}} account, click the link b Update your {{{ ctf_name }}} email Before we add this email to your account, we need to make sure it's actually you. -To add this email to your {{{ ctf_name }}} account, click the button below. +To add this email to your {{{ ctf_name }}} account, click the link below. {{ /update }} {{{ origin }}}/verify#token={{{ token }}} diff --git a/test/integration/auth.js b/test/integration/auth.js index 76ee48bb4..b35828f38 100644 --- a/test/integration/auth.js +++ b/test/integration/auth.js @@ -120,18 +120,3 @@ test.serial('succeeds with goodUserUpdate', async t => { t.is(respUser.email, testUser.email) t.is(respUser.division, nextUser.division) }) - -test.serial('succeeds with goodUserDelete', async t => { - const user = await database.auth.getUserByEmail({ - email: testUser.email - }) - - const authToken = await auth.token.getToken(auth.token.tokenKinds.auth, user.id) - - const resp = await request(app) - .delete(process.env.API_ENDPOINT + '/users/me') - .set('Authorization', ' Bearer ' + authToken) - .expect(responseList.goodUserDelete.status) - - t.is(resp.body.kind, 'goodUserDelete') -})