Skip to content

Commit

Permalink
comments out code for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Mousecop committed Jul 23, 2017
1 parent 9a95e32 commit fbb5d0e
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions controllers/authentication.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
const jwt = require('jwt-simple');
// const jwt = require('jwt-simple');
const {User} = require('../models/models');
const config = require('../config');
// const config = require('../config');

function tokenForUser(user) {
console.log(user)
const timestamp = new Date().getTime();
// sub: subject
// iat: issued at time
return jwt.encode({ sub: user, iat: timestamp }, config.secret);
}
// function tokenForUser(user) {
// console.log(user)
// const timestamp = new Date().getTime();
// // sub: subject
// // iat: issued at time
// return jwt.encode({ sub: user, iat: timestamp }, config.secret);
// }

exports.signin = function(req, res, next) {
// User has already had their email and password auth'd
// We just need to give them a token
console.log('signin req', req.body.username)
res.json({
token: tokenForUser(req.body.username),
user: req.body
});
next();
}
// exports.signin = function(req, res, next) {
// // User has already had their email and password auth'd
// // We just need to give them a token
// console.log('signin req', req.body.username)
// res.json({
// token: tokenForUser(req.body.username),
// user: req.body
// });
// next();
// }

// function userInfo(user) {
// return {_id: user._id, email: user.email}
Expand Down

0 comments on commit fbb5d0e

Please sign in to comment.