auth.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. const asyncHandler = require("express-async-handler");
  2. const { Router } = require("express");
  3. const validators = require("../handlers/validators");
  4. const helpers = require("../handlers/helpers");
  5. const auth = require("../handlers/auth");
  6. const router = Router();
  7. router.post(
  8. "/login",
  9. validators.login,
  10. asyncHandler(helpers.verify("partials/login_signup")),
  11. asyncHandler(auth.local),
  12. asyncHandler(auth.login)
  13. );
  14. router.post(
  15. "/signup",
  16. auth.signupAccess,
  17. validators.signup,
  18. asyncHandler(helpers.verify("partials/login_signup")),
  19. asyncHandler(auth.signup)
  20. );
  21. // router.post("/renew", asyncHandler(auth.jwt), asyncHandler(auth.token));
  22. // router.post(
  23. // "/change-password",
  24. // asyncHandler(auth.jwt),
  25. // validators.changePassword,
  26. // asyncHandler(helpers.verify),
  27. // asyncHandler(auth.changePassword)
  28. // );
  29. // router.post(
  30. // "/change-email",
  31. // asyncHandler(auth.jwt),
  32. // validators.changePassword,
  33. // asyncHandler(helpers.verify),
  34. // asyncHandler(auth.changeEmailRequest)
  35. // );
  36. // router.post(
  37. // "/apikey",
  38. // asyncHandler(auth.jwt),
  39. // asyncHandler(auth.generateApiKey)
  40. // );
  41. // router.post("/reset-password", asyncHandler(auth.resetPasswordRequest));
  42. module.exports = router;