예제 #1
0
        public ActionResult login(Dictionary <string, string> queryvalues)
        {
            string username  = queryvalues.ContainsKey("username") ? queryvalues["username"] : "";
            string password  = queryvalues.ContainsKey("password") ? queryvalues["password"] : "";
            string ReturnUrl = queryvalues.ContainsKey("ReturnUrl") ? queryvalues["ReturnUrl"] : "";

            CLoginUser user = ClubBLL.GetCLoginUserByLoginName(new CLoginUser {
                UserAccount = username
            });



            if (user == null || string.IsNullOrEmpty(user.UserAccount))
            {
                return(Json(
                           new { result = Result.UserDoesNotExist }
                           ));
            }

            if (user.UserPassword == password)
            {
                Session["name"] = username;

                return(Json(RedirectToLocal(ReturnUrl)));
            }
            else
            {
                return(Json(new { result = Result.PasswordIsIncorrect }));
            }
        }