MCPcopy Create free account
hub / github.com/cnodejs/nodeclub / gen_session

Function gen_session

controllers/sign.js:333–336  ·  view source on GitHub ↗
(user, res)

Source from the content-addressed store, hash-verified

331
332// private
333function gen_session(user, res) {
334 var auth_token = encrypt(user._id + '\t' + user.name + '\t' + user.pass + '\t' + user.email, config.session_secret);
335 res.cookie(config.auth_cookie_name, auth_token, {path: '/', maxAge: 1000 * 60 * 60 * 24 * 30}); //cookie 有效期30天
336}
337
338function encrypt(str, secret) {
339 var cipher = crypto.createCipher('aes192', secret);

Callers 1

sign.jsFile · 0.85

Calls 1

encryptFunction · 0.85

Tested by

no test coverage detected