-
Notifications
You must be signed in to change notification settings - Fork 1
Authentication
Shodiqul Muzaki edited this page Jan 14, 2016
·
2 revisions
var ModelUser = db.collection('users');
var data = {
username : 'user',
password : 'password'
}
req.cermai.login(ModelUser, data, req, function(err, result) {
if (result == true) {
// DO SOMETHING WHEN LOGIN SUCCESS //
}
else {
// DO SOMETHING WHE LOGIN FAILED //
}
})
- ** data ** : contains the username and password that you want matched to the database
- ** username ** : check for matching username
- ** password ** : check for matching password
- ** ModelUser ** : collections on database mongodb
add midleware on your handler example code
cermai.get('/main', cermai.isAuth, Welcome.index);
req.cermai.logout(req,res, urlToRedirect);
Support By Syntax Blog