mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(api): adjust logging in bouncer, downgrade to trace (#59945)
This commit is contained in:
committed by
GitHub
parent
07c45a1ac4
commit
27689faf41
@@ -21,8 +21,8 @@ const plugin: FastifyPluginCallback = (fastify, _options, done) => {
|
||||
if (!req.user) {
|
||||
const logger = fastify.log.child({ req });
|
||||
|
||||
logger.debug(
|
||||
'User tried to access a protected route without being authenticated.'
|
||||
logger.trace(
|
||||
'Protected route accessed by unauthenticated user. Sent 401.'
|
||||
);
|
||||
|
||||
await reply.status(401).send({
|
||||
@@ -38,8 +38,8 @@ const plugin: FastifyPluginCallback = (fastify, _options, done) => {
|
||||
async function (req: FastifyRequest, reply: FastifyReply) {
|
||||
const logger = fastify.log.child({ req });
|
||||
if (!req.user) {
|
||||
logger.debug(
|
||||
'User tried to access a protected route without being authenticated.'
|
||||
logger.trace(
|
||||
'Protected route accessed by unauthenticated user. Redirecting to login.'
|
||||
);
|
||||
const { origin } = getRedirectParams(req);
|
||||
await reply.redirectWithMessage(origin, {
|
||||
@@ -59,7 +59,7 @@ const plugin: FastifyPluginCallback = (fastify, _options, done) => {
|
||||
|
||||
const { returnTo } = getRedirectParams(req);
|
||||
|
||||
logger.debug(`User is being redirected to: ${returnTo}`);
|
||||
logger.trace(`User ${req.user?.id} redirected to: ${returnTo}`);
|
||||
|
||||
await reply.redirect(returnTo);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user