public IActionResult Index(Models.UserClass user)
 {
     if (user.UserName == "Zeynep" && user.UserPassword == "1234")
     {
         return(RedirectToAction("Index", "Admin"));
     }
     return(View());
 }
Example #2
0
        public IActionResult Login(Models.UserClass user)
        {
            var user1 = new Models.UserClass();

            user1.ad    = "Zeynep";
            user1.soyad = "Çelik";
            user1.sifre = "12345";
            return(View(user1));
        }
Example #3
0
        public ActionResult Login(Models.UserClass signin)
        {
            if (signin.uid == null || signin.pwd == null)
            {
                ModelState.AddModelError("", "Du måste fylla i alla fält.");
                return(View());
            }

            bool trueUser = false;

            // trueUser = System.Web.Security.FormsAuthentication.Authenticate(signin.uid, signin.pwd);
            trueUser = validateLogin(signin.uid, signin.pwd);

            if (trueUser == true)
            {
                System.Web.Security.FormsAuthentication.RedirectFromLoginPage(signin.uid, false);
            }

            ModelState.AddModelError("", "Ditt användarnamn eller lösenord är fel.");
            return(View());
        }