I am quite new to sailsjs and nodejs. I am trying to create an authentication page, wherein once a user is authenticated, I want to set
req.session.user = user.id
req.session.authenticated = true
res.locals.user = _.clone( req.session.user )
req object is available in your views by default, unless you overwrite
res.locals completely. So you can access a session variable in your view with
<%=req.session.user%> (if you're using EJS). You don't have to copy it explicitly into your locals.