public ActionResult Confirmation(int UserID, string token)
        {
            AccessModel model = new AccessModel();

            token = token.StringSafe();                 //eliminate nulls

            model.UserID    = UserID;
            model.UserToken = token;
            bool bRet = false;

            model.ErrorMessage = "If you no longer have a code, click the 'Resend' button";

            if (token.Length > 0)
            {
                bRet = model.Confirm();
            }


            if (bRet)
            {
                UserType user = new AccessModel().GetUserByUserID(UserID);
                if (user != null)
                {
                    UserCache.AddToCache(user);
                    UserCache.findInCache(ViewBag.IPAddress.StringSafe());
                }
                return(RedirectToAction("index", "home"));
            }
            else if (model.UserToken.Length > 0)
            {
                model.ErrorMessage = "Confirmation Code Failed!";
            }
            else
            {
                model.ErrorMessage = "Click Resend to receive a new confirmation message";
            }

            return(View(model));
        }
        public ActionResult Confirmation(AccessModel model)
        {
            if (model.UserID < 1)
            {
                UserType user = UserCache.GetFromCache(0, ViewBag.IPAddress.StringSafe());
                model.UserID = user.UserID;
            }
            bool bRet = model.Confirm();

            if (bRet)
            {
                UserCache.Update(model.UserID, "index", true);
                return(RedirectToAction("index", "home"));
            }
            else if (model.UserToken.Length > 0)
            {
                model.ErrorMessage = "Confirmation Code Failed!";
                SaveError error = new SaveError();
                ErrorType err   = new ErrorType
                {
                    Err_Message = "Confirmation Error",
                    LiteralDesc = model.UserToken,
                    SQL         = model.GetToken(model.UserID),
                    Page        = "Confirmation",
                    Process     = "Confirmation",
                    Err_Subject = "User could not confirm",
                    UserID      = model.UserID
                };
                error.ReportError(err);
            }
            else
            {
                model.ErrorMessage = "Click Resend to receive a new confirmation message";
            }

            return(View(model));
        }