update auth

This commit is contained in:
Jake Kasper
2025-08-21 11:03:18 -05:00
parent 54a29ebac6
commit 2a7d22e1c8
2 changed files with 7 additions and 3 deletions

View File

@@ -7,6 +7,7 @@ const pool = require('../config/database');
const { validateRequest } = require('../utils/validation');
const { registerSchema, loginSchema, changePasswordSchema } = require('../utils/validation');
const { AppError } = require('../middleware/errorHandler');
const { authenticateToken } = require('../middleware/auth');
const router = express.Router();
@@ -231,7 +232,7 @@ router.get('/authentik/callback',
// @route POST /api/auth/change-password
// @desc Change user password
// @access Private
router.post('/change-password', validateRequest(changePasswordSchema), async (req, res, next) => {
router.post('/change-password', authenticateToken, validateRequest(changePasswordSchema), async (req, res, next) => {
try {
const { currentPassword, newPassword } = req.body;
const userId = req.user.id;
@@ -305,7 +306,7 @@ router.post('/forgot-password', async (req, res, next) => {
// @route GET /api/auth/me
// @desc Get current user info
// @access Private
router.get('/me', async (req, res, next) => {
router.get('/me', authenticateToken, async (req, res, next) => {
try {
const userResult = await pool.query(
'SELECT id, email, first_name, last_name, role, created_at FROM users WHERE id = $1',