I disable blueprints rooting ( actions: false, rest: false, shortcuts: false ) and i want when a user login i can capte user's information in the "account" view, i use mongodb database and sails-mongo as adapter
UserController.js
account : function (req, res, next) {
User.findOne(req.param('id'), function foundUser(err, user){
if (err) return next(err);
if (!user) return next();
res.view({
user: user
});
});
},
login: function (req, res) {
// See `api/responses/login.js`
return res.login({
email: req.param('email'),
password: req.param('password'),
successRedirect: '/user/account/' + user.id ,
invalidRedirect: '/user/login'
});
},
account.ejs
<div class="col-lg-12">
<h1 class="page-header">
<%= user.firstname +' '+ user.lastname %></h1>
<ol class="breadcrumb">
<li class="active">
<i class="fa fa-dashboard"></i> Dashboard
</li>
</ol>
</div>
routes.js
'get /user/login': { view: 'User/login' },
'get /user/signup': { view: 'User/signup' },
'/user/account/:id': { view: 'User/account' },
'post /user/login': 'UserController.login',
'post /user/signup': 'UserController.signup',
'/user/logout': 'UserController.logout',
'user/account/:id': 'UserController.account'
after login i want to fetch name, email of the user by id to use it in the view like this
<a class="text-center" href="#">
<strong>Welcome <%= user.firstname %></strong>
<i class="fa fa-angle-right"></i>
</a>
how can i do it, thanks.