Exemplo n.º 1
0
        public BusinessLayerResult <EvernoteUser> GetUserByEmail(MailModel2 model)
        {
            BusinessLayerResult <EvernoteUser> res = new BusinessLayerResult <EvernoteUser>();

            res.Result = Find(x => x.Email == model.Mail);
            if (res.Result == null)
            {
                res.AddError(ErrorMessageCode.UserNotFound, "Bu E-posta'ya Ait Kullanıcı bulunamadı.");
            }
            return(res);
        }
 public ActionResult About(MailModel2 model)
 {
     if (ModelState.IsValid)
     {
         var body = new StringBuilder();
         body.AppendLine("İsim: " + model.Name);
         body.AppendLine("Eposta: " + model.Mail);
         body.AppendLine("Konu: " + model.Text);
         MailHelper.SendMailForAbout(body.ToString());
         ViewBag.Success = true;
     }
     return(View());
 }
        public ActionResult PasswordForget(MailModel2 model)
        {
            string sifre    = RastgeleUret();
            string sifreMD5 = MD5Encryption.MD5Sifrele(sifre);

            BusinessLayerResult <EvernoteUser> res = eum.GetUserByEmail(model);

            //var response = Request["g-recaptcha-response"];
            //const string secret = "6LcjInAUAAAAADx99wOz1kr3QVnSrgYrX61f0eU0";

            //var client = new WebClient();
            //var reply =
            //    client.DownloadString(
            //        string.Format("https://www.google.com/recaptcha/api/siteverify?secret={0}&response={1}", secret, response));

            //var captchaResponse = JsonConvert.DeserializeObject<CaptchaResponse>(reply);

            //if (!captchaResponse.Success)
            //    TempData["Message"] = "Lütfen güvenliği doğrulayınız.";
            //else
            //{

            if (res.Errors.Count > 0)
            {
                res.Errors.ForEach(x => ModelState.AddModelError("", x.Message));

                return(View(model));
            }

            StringBuilder body = new StringBuilder();

            body.AppendLine("Merhaba, " + res.Result.Username);
            body.AppendLine("\nYeni Şifreniz : " + sifre);
            MailHelper.SendMail(body.ToString(), model.Mail, "Makalemre.com Sitesi Yeni Şifre");
            ViewBag.Success = true;

            res.Result.Password = sifreMD5;
            BusinessLayerResult <EvernoteUser> res2 = eum.Update(res.Result);

            //}
            return(View());
        }