public ActionResult LogIn(Login user, string returnUrl)
        {
            // Check if both Username and Password are present
            if (user.Password != null && user.UserName != null)
            {
                // Find a user with the given username in the database
                var userPass = from memberUser in db.Users
                               where memberUser.UserName == user.UserName
                               select memberUser.Password;

                // If the user exists check if the password is correct
                if (userPass.Count() == 1 && PasswordHasher.Hash(user.Password) == userPass.First())
                {
                    // User is logged in, set a cookie
                    FormsAuthentication.SetAuthCookie(user.UserName, true);

                    // Go to home page
                    return RedirectToAction("Index", "Home");
                }
                else
                {
                    // Display an error
                    ModelState.AddModelError("", "Ongeldig gebruikersnaam of wachtwoord.");
                }
            }

            return View(user);
        }
        public ActionResult Index(Login user)
        {
            // Check if both Username and Password are present
            if (user.Password != null && user.UserName != null)
            {
                // Find a user with the given username in the database
                var userPass = from memberUser in db.Users
                               where memberUser.UserName == user.UserName
                               select memberUser;

                // If the user exists check if the password is correct
                if (userPass.Count() == 1 && Cryptography.PasswordHash(user.Password) == userPass.First().Password)
                {
                    if (userPass.First().Activated == 1)
                    {
                        // User is logged in, set a cookie
                        FormsAuthentication.SetAuthCookie(user.UserName, true);

                        // Go to home page
                        return RedirectToAction("index", "default");
                    }
                    else
                        ModelState.AddModelError("", "Dit account is nog niet geactiveerd. Controleer uw inbox aub.");
                }
                else
                {
                    // Display an error
                    ModelState.AddModelError("", "Ongeldig gebruikersnaam of wachtwoord.");
                }
            }

            ViewBag.UserName = user.UserName;

            return View();
        }