mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
feat(api): deprecate get account endpoint (#50419)
This commit is contained in:
@@ -21,6 +21,7 @@ import {
|
||||
createDeleteUserToken,
|
||||
encodeUserToken
|
||||
} from '../middlewares/user-token';
|
||||
import { deprecatedEndpoint } from '../utils/disabled-endpoints';
|
||||
|
||||
const log = debugFactory('fcc:boot:user');
|
||||
const sendNonUserToHome = ifNoUserRedirectHome();
|
||||
@@ -34,7 +35,7 @@ function bootUser(app) {
|
||||
const postUserToken = createPostUserToken(app);
|
||||
const deleteUserToken = createDeleteUserToken(app);
|
||||
|
||||
api.get('/account', sendNonUserToHome, getAccount);
|
||||
api.get('/account', sendNonUserToHome, deprecatedEndpoint);
|
||||
api.get('/account/unlink/:social', sendNonUserToHome, getUnlinkSocial);
|
||||
api.get('/user/get-session-user', getSessionUser);
|
||||
api.post('/account/delete', ifNoUser401, deleteUserToken, postDeleteAccount);
|
||||
@@ -162,11 +163,6 @@ function createReadSessionUser(app) {
|
||||
};
|
||||
}
|
||||
|
||||
function getAccount(req, res) {
|
||||
const { username } = req.user;
|
||||
return res.redirect('/' + username);
|
||||
}
|
||||
|
||||
function getUnlinkSocial(req, res, next) {
|
||||
const { user } = req;
|
||||
const { username } = user;
|
||||
|
||||
@@ -6,7 +6,8 @@ type Endpoints = [string, 'GET' | 'POST'][];
|
||||
export const endpoints: Endpoints = [
|
||||
['/refetch-user-completed-challenges', 'POST'],
|
||||
['/certificate/verify-can-claim-cert', 'GET'],
|
||||
['/api/github', 'GET']
|
||||
['/api/github', 'GET'],
|
||||
['/account', 'GET']
|
||||
];
|
||||
|
||||
export const deprecatedEndpoints: FastifyPluginCallbackTypebox = (
|
||||
|
||||
Reference in New Issue
Block a user