public ActionResult Remind(string user_guid)
        {
            try
            {
                using (ReportScheduleEntities db = new ReportScheduleEntities())
                {
                    Guid guid = Guid.Parse(user_guid);

                    Reminded remind = db.Reminded.Where(x => x.remind_guid == guid).SingleOrDefault();

                    if (remind == null)
                    {
                        ViewBag.Action = "Не найдено в таблице запроса на восстановление пароля.";
                        return(View("Index", null));
                    }

                    if (remind.remind_user_id == 0)
                    {
                        ViewBag.Action = "Неопознанная ошибка при восстановлении пароля. Сделайте запрос на восстановление еще раз";
                        return(View("Index", null));
                    }

                    ViewBag.Action     = "Remind";
                    ViewBag.RemindGUID = user_guid;
                    return(View("Index"));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public JsonResult ChangePassword(UserViewModel model)
        {
            var result = 0;

            try
            {
                using (ReportScheduleEntities db = new ReportScheduleEntities())
                {
                    Guid guid = Guid.Parse(Request.Form["guid"].ToString());

                    Reminded remind = db.Reminded.Where(x => x.remind_guid == guid).SingleOrDefault();

                    if ((remind.remind_user_id > 0) && (model.user_password != null) && (model.user_password.Trim() != ""))
                    {
                        Users Use = db.Users.SingleOrDefault(x => x.user_id == remind.remind_user_id);
                        Use.user_password = encryption(model.user_password);
                        db.SaveChanges();

                        db.Reminded.Remove(remind);
                        db.SaveChanges();
                    }
                    else
                    {
                        result = 1;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Forgot(LoginViewModel userModel)
        {
            try
            {
                using (ReportScheduleEntities db = new ReportScheduleEntities())
                {
                    if (userModel.user_email.Trim() == "")
                    {
                        ViewBag.Action = "Forgot";
                        return(View("Index", userModel));
                    }

                    if (!CheckUserEmail(userModel.user_email.Trim(), userModel.user_id))
                    {
                        userModel.LoginErrorMessage = "Такой email в системе не зарегистрирован!";
                        ViewBag.Action = "Forgot";
                        return(View("Index", userModel));
                    }

                    Users user = db.Users.Where(x => x.user_email == userModel.user_email.Trim()).SingleOrDefault();

                    Guid guid = Guid.NewGuid();

                    Reminded remind = new Reminded()
                    {
                        remind_guid    = guid,
                        remind_user_id = user.user_id
                    };

                    SendMailForgot(user.user_id, user.user_email, guid.ToString());

                    db.Reminded.Add(remind);
                    db.SaveChanges();

                    ViewBag.Action = "Forgoted";
                    return(View("Index", userModel));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }