Beispiel #1
0
        public ActionResult Register(UserModel user)
        {
            if (ModelState.IsValid)
            {
                UserDbUtilities.AddUserToDb(user);
            }

            return(RedirectToAction("Index", "Home"));
        }
Beispiel #2
0
        private bool IsValid(ref UserModel userModel)
        {
            var crypto = new SimpleCrypto.PBKDF2();

            var isValid = false;

            var user = UserDbUtilities.GetUser(userModel.Email);

            if (user != null)
            {
                if (user.Parola == crypto.Compute(userModel.Parola, user.CheieParola))
                {
                    isValid      = true;
                    userModel.id = user.Id;
                }
            }

            return(isValid);
        }