Skip to content
Snippets Groups Projects
Commit 564aa706 authored by syuilo's avatar syuilo
Browse files

[API] Fix: Validate ids

parent 2a6ac7e3
No related branches found
No related tags found
No related merge requests found
......@@ -28,6 +28,11 @@ module.exports = (params, user) =>
return rej('user_id is required');
}
// Validate id
if (!mongo.ObjectID.isValid(userId)) {
return rej('incorrect user_id');
}
// 自分自身
if (user._id.equals(userId)) {
return rej('followee is yourself');
......
......@@ -27,6 +27,11 @@ module.exports = (params, user) =>
return rej('user_id is required');
}
// Validate id
if (!mongo.ObjectID.isValid(userId)) {
return rej('incorrect user_id');
}
// Check if the followee is yourself
if (user._id.equals(userId)) {
return rej('followee is yourself');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment