Advertisement
Guest User

Untitled

a guest
Dec 18th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. 'use strict';
  2.  
  3. let express = require('express');
  4. let controller = require('src/modules/login/controller');
  5. let validation = require('src/utils/validation/middleware');
  6. let validator = require('./validator');
  7.  
  8. let router = new express.Router();
  9.  
  10. let validate = validation.mw(validator, 'req.body');
  11.  
  12. /**
  13. * @api {post} /customer/forgot-password Forgot password for customer
  14. * @apiName ForgotPassword Customer
  15. * @apiGroup Login
  16. *
  17. * @apiSuccess (200) {Object} customer Empty object
  18. * @apiError (400) {Object} ValidationError List of errors
  19. */
  20. router.post('/customer/forgot-password', validate('ForgotPassword'), controller.forgotPassword);
  21.  
  22. /**
  23. * @api {post} /customer/recover-password Recover password for customer
  24. * @apiName RecoverPassword Customer
  25. * @apiGroup Login
  26. *
  27. * @apiSuccess (200) {Object} customer Empty object
  28. * @apiError (400) {Object} ValidationError List of errors
  29. */
  30. router.post('/customer/recover-password', validate('RecoverPassword'), controller.recoverPassword);
  31.  
  32. /**
  33. * @api {post} /customer/singin Sign in customer
  34. * @apiName SignIn Customer
  35. * @apiGroup Login
  36. *
  37. * @apiSuccess (200) {Object} customer Signed up customer object
  38. * @apiError (400) {Object} ValidationError List of errors
  39. */
  40. router.post('/customer/signup', controller.passportAuth('customer:signup'));
  41.  
  42. /**
  43. * @api {post} /customer/signin Sign in customer
  44. * @apiName Login Customer
  45. * @apiGroup Login
  46. *
  47. * @apiSuccess (200) {Object} customer Logged in customer object
  48. * @apiError (400) {Object} ValidationError List of errors
  49. */
  50. router.post('/customer/signin', controller.passportAuth('customer:signin'));
  51.  
  52. /**
  53. * @api {post} /staff/signin Sign In staff
  54. * @apiName Login staff
  55. * @apiGroup Login
  56. *
  57. * @apiSuccess (200) {Object} login Logged in login object
  58. * @apiError (400) {Object} ValidationError List of errors
  59. */
  60. router.post('/staff/signin', controller.passportAuth('staff:signin'));
  61.  
  62. /**
  63. * @api {post} /api/signin Sign In API
  64. * @apiName Login API
  65. * @apiGroup Login
  66. *
  67. * @apiSuccess (200) {Object} login Logged in login object
  68. * @apiError (400) {Object} ValidationError List of errors
  69. */
  70. router.post('/api/signin', controller.passportAuth('api:signin'));
  71.  
  72. /**
  73. * @api {post} /2fa Verify token and login
  74. * @apiName VerifyTokenAndLogin Verify Token And Login
  75. * @apiGroup Login
  76. *
  77. * @apiSuccess (200) {Object} login Logged in login object
  78. * @apiError (400) {Object} ValidationError List of errors
  79. */
  80.  
  81. router.post('/2fa', validate('VerifyCode'), controller.signin);
  82.  
  83. module.exports = router;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement