mirror of
https://github.com/KeyZox71/knl_meowscendence.git
synced 2025-12-31 21:56:41 +01:00
「🔨」 fix(user-management): fix the fact the no fucking route was protected
This commit is contained in:
@ -1,11 +1,8 @@
|
||||
export async function pFriend(request, reply, fastify, getUserInfo, getFriend, addFriend) {
|
||||
try {
|
||||
const userId = request.params.userId;
|
||||
if (!request.user) {
|
||||
return reply.code(400).send({ error: "Please specify a user" });
|
||||
}
|
||||
if (request.user !== 'admin' && request.user !== userId) {
|
||||
return reply.code(401).send({ error: "Unauthorized" });
|
||||
if (request.user !== userId && request.user !== 'admin') {
|
||||
return reply.code(401).send({ error: 'Unauthorized' });
|
||||
}
|
||||
if (!getUserInfo.get(userId)) {
|
||||
return reply.code(404).send({ error: "User does not exist" });
|
||||
|
||||
Reference in New Issue
Block a user