Exemplo n.º 1
0
        public ActionResult Login_Post(Credentials credentials, string ReturnUrl)
        {
            if (!ModelState.IsValid)
            {
                return(View(credentials));
            }
            var password = PasswordHashing.HashesPassword(credentials.Password);
            var vari     = _mySchema.SpAuthenticateUser(credentials.Email, password).FirstOrDefault();

            if (Convert.ToBoolean(vari))
            {
                FormsAuthentication.SetAuthCookie(credentials.Email, false);
                return(RedirectToLocal(ReturnUrl));
            }
            else
            {
                ModelState.AddModelError(string.Empty, "No User Exist Against Email Id and Password");
                return(View(credentials));
            }
        }