|
const express = require('express'); |
|
const { |
|
resetPasswordRequestController, |
|
resetPasswordController, |
|
|
|
registrationController, |
|
} = require('../controllers/AuthController'); |
|
const { loginController } = require('../controllers/auth/LoginController'); |
|
const { logoutController } = require('../controllers/auth/LogoutController'); |
|
const requireJwtAuth = require('../../middleware/requireJwtAuth'); |
|
const requireLocalAuth = require('../../middleware/requireLocalAuth'); |
|
|
|
const router = express.Router(); |
|
|
|
|
|
router.post('/logout', requireJwtAuth, logoutController); |
|
router.post('/login', requireLocalAuth, loginController); |
|
|
|
if (process.env.ALLOW_REGISTRATION) { |
|
router.post('/register', registrationController); |
|
} |
|
router.post('/requestPasswordReset', resetPasswordRequestController); |
|
router.post('/resetPassword', resetPasswordController); |
|
|
|
module.exports = router; |
|
|