public ActionResult TermsAgree(String id)
        {
            UserDBAccess db = new UserDBAccess();

            SessionVariables.UserData = db.GetUserInfoByName(User.Identity.Name);
            UsersDatabaseEntities entities = new UsersDatabaseEntities();

            //User agreed to terms of use
            entities.AgreeToTermsOfUse(SessionVariables.UserData.Id);
            return(Redirect("/Home/Index"));
        }
        public ActionResult NewUser(FormCollection form, Users userss)
        {
            var    response  = Request["g-recaptcha-response"];
            string secretKey = "6LcH-TQUAAAAAPKXLLGq65vU3yo06BZ2FgGyiWxs";
            var    client    = new WebClient();
            var    result    = client.DownloadString(string.Format("https://www.google.com/recaptcha/api/siteverify?secret={0}&response={1}", secretKey, response));
            var    obj       = JObject.Parse(result);
            var    status    = (bool)obj.SelectToken("success");


            //ViewBag.Message = status ? "Google reCaptcha validation success" : "Google reCaptcha validation failed";
            ViewData["loginModal"] = -100;
            Users users  = new Users();
            bool  agreed = form["agree"].Equals("on");

            if (status && agreed)
            {
                //New user db Access function

                users.Name       = form["Username"].ToString();
                users.Email      = form["Email"].ToString();
                users.Phone      = form["Phone"].ToString();
                users.Address    = form["Address"].ToString();
                users.Password   = form["Password"].ToString();
                users.Repassword = form["RepeatPassword"].ToString();
                users.Dob        = System.Convert.ToDateTime(form["DOB"].ToString());
                users.Rememberme = userss.Rememberme;

                //Check user input
                if (inputValidation.UserInputValidation(users) && inputValidation.UserInputValidation(userss))
                {
                    SecurityO sec = new SecurityO();
                    sec.Username = users.Name;
                    sec.Password = users.Password;
                    UserDBAccess db = new UserDBAccess();
                    //Create user in Database
                    bool correct = UserDBAccess.CreateUserAccount(users, sec);
                    if (correct)
                    {
                        SessionVariables.UserData = users;
                        //get users id by name
                        users = db.GetUserInfoByName(users.Name);
                        //set agreed
                        UsersDatabaseEntities entities = new UsersDatabaseEntities();
                        entities.AgreeToTermsOfUse(users.Id);
                    }
                    else
                    {
                        ModelState.AddModelError("Username", "Username Already exists");
                        ViewData["LoginFail"] = "Name Already exists";
                        return(RedirectToAction("Login", ViewData));
                    }
                }
                else
                {
                    ModelState.AddModelError("Username", "You input an invalid character into the text box");
                }
            }

            //Default
            return(RedirectToAction("Login", users));
        }