2018-11-01 02:51:01 +00:00
|
|
|
/**
|
|
|
|
* sessionAuth
|
|
|
|
*
|
|
|
|
* @module :: Policy
|
|
|
|
* @description :: Simple policy to allow any authenticated user
|
|
|
|
* @docs :: http://sailsjs.org/#!documentation/policies
|
|
|
|
*/
|
|
|
|
module.exports = function (req, res, next) {
|
2019-02-26 03:29:18 +00:00
|
|
|
if (process.env.NODE_ENV === 'development') return next()
|
|
|
|
if (req.session.authenticated) return next()
|
|
|
|
// res.status(403).json({ error: 'You are not permitted to perform this action.' })
|
|
|
|
res.redirect('/login')
|
2018-11-01 02:51:01 +00:00
|
|
|
}
|