Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- let express = require('express');
- let controller = require('src/modules/login/controller');
- let validation = require('src/utils/validation/middleware');
- let validator = require('./validator');
- let router = new express.Router();
- let validate = validation.mw(validator, 'req.body');
- /**
- * @api {post} /customer/forgot-password Forgot password for customer
- * @apiName ForgotPassword Customer
- * @apiGroup Login
- *
- * @apiSuccess (200) {Object} customer Empty object
- * @apiError (400) {Object} ValidationError List of errors
- */
- router.post('/customer/forgot-password', validate('ForgotPassword'), controller.forgotPassword);
- /**
- * @api {post} /customer/recover-password Recover password for customer
- * @apiName RecoverPassword Customer
- * @apiGroup Login
- *
- * @apiSuccess (200) {Object} customer Empty object
- * @apiError (400) {Object} ValidationError List of errors
- */
- router.post('/customer/recover-password', validate('RecoverPassword'), controller.recoverPassword);
- /**
- * @api {post} /customer/singin Sign in customer
- * @apiName SignIn Customer
- * @apiGroup Login
- *
- * @apiSuccess (200) {Object} customer Signed up customer object
- * @apiError (400) {Object} ValidationError List of errors
- */
- router.post('/customer/signup', controller.passportAuth('customer:signup'));
- /**
- * @api {post} /customer/signin Sign in customer
- * @apiName Login Customer
- * @apiGroup Login
- *
- * @apiSuccess (200) {Object} customer Logged in customer object
- * @apiError (400) {Object} ValidationError List of errors
- */
- router.post('/customer/signin', controller.passportAuth('customer:signin'));
- /**
- * @api {post} /staff/signin Sign In staff
- * @apiName Login staff
- * @apiGroup Login
- *
- * @apiSuccess (200) {Object} login Logged in login object
- * @apiError (400) {Object} ValidationError List of errors
- */
- router.post('/staff/signin', controller.passportAuth('staff:signin'));
- /**
- * @api {post} /api/signin Sign In API
- * @apiName Login API
- * @apiGroup Login
- *
- * @apiSuccess (200) {Object} login Logged in login object
- * @apiError (400) {Object} ValidationError List of errors
- */
- router.post('/api/signin', controller.passportAuth('api:signin'));
- /**
- * @api {post} /2fa Verify token and login
- * @apiName VerifyTokenAndLogin Verify Token And Login
- * @apiGroup Login
- *
- * @apiSuccess (200) {Object} login Logged in login object
- * @apiError (400) {Object} ValidationError List of errors
- */
- router.post('/2fa', validate('VerifyCode'), controller.signin);
- module.exports = router;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement