feat: Add API key authentication (#1254)

Closes #945
This commit is contained in:
Samuel
2025-11-06 20:56:48 +01:00
committed by GitHub
parent 5a2564f575
commit b4cbd32bf2
75 changed files with 1501 additions and 94 deletions

View File

@@ -78,6 +78,12 @@ const getOneActiveByEmailOrUsername = (emailOrUsername) => {
});
};
const getOneActiveByApiKeyHash = (apiKeyHash) =>
User.findOne({
apiKeyHash,
isDeactivated: false,
});
const updateOne = async (criteria, values) => {
const enforceActiveLimit =
values.isDeactivated === false && sails.config.custom.activeUsersLimit !== null;
@@ -201,6 +207,7 @@ module.exports = {
getOneById,
getOneByEmail,
getOneActiveByEmailOrUsername,
getOneActiveByApiKeyHash,
updateOne,
deleteOne,
};