|
|
@ -39,7 +39,7 @@ router.post('/setup', BodyParserJson(), async (req, res) => {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// User login
|
|
|
|
// User login
|
|
|
|
router.post('/login', rateLimiterMiddleware("login", UserConfig.config.rateLimit?.login), BodyParserJson(), (req, res) => {
|
|
|
|
router.post('/login', rateLimiterMiddleware('login', UserConfig.config.rateLimit?.login), BodyParserJson(), (req, res) => {
|
|
|
|
const { username, password } = req.body;
|
|
|
|
const { username, password } = req.body;
|
|
|
|
|
|
|
|
|
|
|
|
data.getAll('users')
|
|
|
|
data.getAll('users')
|
|
|
@ -69,7 +69,7 @@ router.post('/login', rateLimiterMiddleware("login", UserConfig.config.rateLimit
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// todo: authenticate API endpoints
|
|
|
|
// todo: authenticate API endpoints
|
|
|
|
router.post('/user', rateLimiterMiddleware("api", UserConfig.config.rateLimit?.api), BodyParserJson(), async (req, res) => {
|
|
|
|
router.post('/user', rateLimiterMiddleware('api', UserConfig.config.rateLimit?.api), BodyParserJson(), async (req, res) => {
|
|
|
|
if (!UserConfig.ready)
|
|
|
|
if (!UserConfig.ready)
|
|
|
|
return res.status(409).json({ success: false, message: 'User config not ready' });
|
|
|
|
return res.status(409).json({ success: false, message: 'User config not ready' });
|
|
|
|
|
|
|
|
|
|
|
|