예제 #1
0
        public ActionResult TokenInsertion(string token)
        {
            if (token == "" || token == null)
            {
                ModelState.AddModelError("", "Your token is incorrect!");
            }
            UpdateList();
            var u = listUser.Find(l => l.PasswordToken == token);

            if (u != null)
            {
                if (u.PasswordTokenExpired > DateTime.Now && u.TokenActivated == false)
                {
                    u.TokenActivated       = true;
                    u.PasswordToken        = null;
                    u.PasswordTokenExpired = null;
                    u.UpdateUser(u);
                    AccountController.RememberSession("token", "true");
                    return(RedirectToAction("RecoveryPassword", "Account"));
                }
                else
                {
                    ModelState.AddModelError("", "Your token is expired!");
                }
            }
            return(View());
        }
예제 #2
0
 // GET: Surveys/Edit/5
 public ActionResult Edit(Guid?id)
 {
     if (AccountController.CheckPermission("Survey-Edit"))
     {
         AccountController.RememberSurveyId((Guid)id);
         AccountController.RememberSession("Edit", "true");
         UpdateList();
         AccountController.RememberSurvey(listSurvey.Find(x => x.Id == id));
         return(RedirectToAction("Create"));
     }
     else
     {
         return(RedirectToAction("Index", "Home"));
     }
 }