UNPKG

849 BJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.useTour = useTour;
7
8var _bodyParser = require('body-parser');
9
10var _bodyParser2 = _interopRequireDefault(_bodyParser);
11
12function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
14function useTour(app, config) {
15 // unpack
16 var email = config.email,
17 localAuthenticateAndRedirect = config.localAuthenticateAndRedirect,
18 password = config.password,
19 returnTo = config.returnTo,
20 routePath = config.routePath;
21 // use
22
23 app.use(_bodyParser2.default.json()); // to support JSON-encoded bodies
24 // automatic signin with a mock user
25 app.post(routePath, function (req, res, next) {
26 req.body.email = email;
27 req.body.password = password;
28 next();
29 }, returnTo, localAuthenticateAndRedirect);
30}
\No newline at end of file