工程
https://github.com/doramart/DoraCMS
D:\NodeJs\redis-2.4.5-win32-win64\64bit
redis-server.exe
mongod --dbpath D:\mongodb\data\db
D:\NodeJs\study_source_code\DoraCMS>node ./bin/www
//下面效验通不过
//if(validator.isUserName(userName) && validator.isPsd(password)){
//直接用明文登录
AdminUser.findOne({'userName':userName,'password':password}).populate('group').exec(function(err,user){
//AdminUser.findOne({'userName':userName,'password':newPsd}).populate('group').exec(function(err,user){
if(err){
res.end(err);
}
if(user) {
// req.session.adminPower = user.group.power;
req.session.adminlogined = true;
req.session.adminUserInfo = user;
//获取管理员通知信息
adminFunc.getAdminNotices(req,res,function(noticeObj){
req.session.adminNotices = noticeObj;
// 存入操作日志
SystemOptionLog.addUserLoginLogs(req,res,adminFunc.getClienIp(req));
res.end("success");
});
}else{
console.log("登录失败");
res.end("用户名或密码错误");
}
});