Esempio n. 1
0
        private bool IsValid(string usuario, string clave)
        {
            var crypto = new SimpleCrypto.PBKDF2();

            bool IsValid = false;

            var user = db.User.FirstOrDefault(u => u.Usuario == usuario);

            if (user != null)
            {
                var userType = db.Usertype.FirstOrDefault(u => user.UserTypeId == u.usertypeid);

                if (userType.description != "Deshabilitado")
                {
                    var cry = crypto.Compute(clave, user.ClaveSalt);
                    if (user.Clave == cry)
                    {
                        IsValid = true;
                        UserLogsController.GuardarLogInLog(user);
                    }
                }
                else
                {
                    ModelState.AddModelError("", "Usuario deshabilitado");
                }
            }
            return(IsValid);
        }
Esempio n. 2
0
        public ActionResult LogOut()
        {
            string LoggedUser = User.Identity.Name;

            UserLogsController.GuardarLogOutLog(LoggedUser);
            FormsAuthentication.SignOut();
            return(RedirectToAction("Login", "Users"));
        }