コード例 #1
0
 public ActionResult Logout()
 {
     //if (User.Identity.IsAuthenticated)
     {
         FormsAuthentication.SignOut();
     }
     return(Redirect(AdminLinkBuilder.Home()));
 }
コード例 #2
0
        public ActionResult Login()
        {
            if (Request.HttpMethod == "POST")
            {
                var    username = RequestHelper.GetRequestFormText(Request, "username");
                var    password = RequestHelper.GetRequestFormText(Request, "password");
                string phone    = BookMedica.Models.Utils.ClearPhone(username);

                var userData = CityStar.Core.UserData.GetByPhone(phone);
                if (userData != null && userData.Password == password)
                {
                    FormsAuthentication.SetAuthCookie(userData.id.ToString(), false, "/");
                    return(Redirect(AdminLinkBuilder.Home()));
                }
                else
                {
                    //result.Status = "error";
                }
            }
            return(View("AdminLoginPage"));
        }