using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Text;
namespace bigtree.Controllers { using bigtree.Models; using bigtree.Model; using bigtree.lib; using System.Net.Mail; using System.Text.RegularExpressions;
public class LoginController : Controller { public ActionResult Index() { return View(); } ///
/// 检查登陆 /// /// /// [HttpPost] public ActionResult CheckLoginInfo(FormCollection f) { try { //post: user , pwd ,remembered string user = f["user"].Trim(); string pwd = f["pwd"].Trim(); string remembered = f["remembered"].Trim();
JsonResult res = new JsonResult(); if (string.IsNullOrEmpty(user) || string.IsNullOrEmpty(pwd)) { res.Data = new { status = 0 }; } //MD5加密后的密码 pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(pwd, "md5").ToLower(); //从数据库读取 Common.WebUser account = MemberInfoService.GetMemberIdForCheck(user, pwd); if (account == null) { res.Data = new { status = 0 }; } else { //{status: 1(success)/0(fail),} res.Data = new { status = 1 }; //todo:登陆成功,记录登陆用户信息保存登陆状态 FunSession.SetSession(account);