Substitute hardcoded auth modes for variables

This commit is contained in:
Tuan Dang
2023-04-07 16:50:05 +03:00
parent a7880db871
commit 5bbe09e4be
31 changed files with 285 additions and 155 deletions
+7 -3
View File
@@ -6,11 +6,15 @@ import {
} from '../../middleware';
import { body } from 'express-validator';
import { usersController } from '../../controllers/v2';
import {
AUTH_MODE_JWT,
AUTH_MODE_API_KEY
} from '../../variables';
router.get(
'/me',
requireAuth({
acceptedAuthModes: ['jwt', 'apiKey']
acceptedAuthModes: [AUTH_MODE_JWT, AUTH_MODE_API_KEY]
}),
usersController.getMe
);
@@ -18,7 +22,7 @@ router.get(
router.patch(
'/me/mfa',
requireAuth({
acceptedAuthModes: ['jwt', 'apiKey']
acceptedAuthModes: [AUTH_MODE_JWT, AUTH_MODE_API_KEY]
}),
body('isMfaEnabled').exists().isBoolean(),
validateRequest,
@@ -28,7 +32,7 @@ router.patch(
router.get(
'/me/organizations',
requireAuth({
acceptedAuthModes: ['jwt', 'apiKey']
acceptedAuthModes: [AUTH_MODE_JWT, AUTH_MODE_API_KEY]
}),
usersController.getMyOrganizations
);