Example #1
0
 public ActionResult PopLogin(string username = null)
 {
     var model = new LoginViewModel();
     if (!string.IsNullOrEmpty(username))
     {
         model.Email = username;
     }
     return View(model);
 }
Example #2
0
        public ActionResult Index(LoginViewModel model, string ReturnUrl = null, bool Remember = false)
        {

            if (ModelState.IsValid)
            {
                try
                {
                    string Md5Password = CheckHelper.StrToMd5(model.Password);
                    if (MemberService.Login(model.Email, Md5Password))
                    {
                        ViewBag.Message = null;

                        if (!string.IsNullOrEmpty(ReturnUrl))
                            return Redirect(ReturnUrl);
                        else
                            return RedirectToAction("index", "home");
                    }
                    else
                    {
                        ViewBag.Message = "您的用户名和密码不匹配";
                        return View(model);
                    }
                }
                catch (Exception ex)
                {
                    LogHelper.WriteLog("用户:" + model.Email + "登录失败!", ex);
                    ViewBag.Message = "服务器错误,请刷新页面重新登录";
                    return View(model);
                }
            }
            else
            {
                ViewBag.Message = "您的输入有误请确认后提交";
                return View(model);
            }
        }
Example #3
0
        public ActionResult PopLogin(LoginViewModel model, bool Remember = false)
        {

            if (ModelState.IsValid)
            {
                try
                {
                    string Md5Password = CheckHelper.StrToMd5(model.Password);
                    if (MemberService.Login(model.Email, Md5Password))
                    {
                        ViewBag.Message = null;
                        return Content("<script>window.top.location.reload();</script>");
                    }
                    else
                    {
                        ViewBag.Message = "您的用户名和密码不匹配";
                        return View(model);
                    }
                }
                catch (Exception ex)
                {
                    LogHelper.WriteLog("用户:" + model.Email + "登录失败!", ex);
                    ViewBag.Message = "服务器错误,请刷新页面重新登录";
                    return View(model);
                }
            }
            else
            {
                ViewBag.Message = "您的输入有误请确认后提交";
                return View(model);
            }
        }