1 Mayıs 2015 Cuma

Remember password

        public Result RememberPassword(string username)
        {
            try
            {
                var user = Context.Users.Find(username);
                var smtpSection = (SmtpSection)ConfigurationManager.GetSection("mailSettings/no_reply");
                var smtpClient = new SmtpClient(smtpSection.Network.Host, smtpSection.Network.Port)
                {
                    Credentials = new NetworkCredential(smtpSection.Network.UserName, smtpSection.Network.Password),
                    EnableSsl = smtpSection.Network.DefaultCredentials
                };
                var mailMessage = new MailMessage { From = new MailAddress(smtpSection.From, "Paü Dedikodu") };
                mailMessage.To.Add(user.Email);
                mailMessage.Subject = "Paudedikodu.com - Şifre sıfırlama";
#warning akif- link düzeltielecek. mail gönderme common service'e alınacak
                mailMessage.Body = System.IO.File.ReadAllText(HttpContext.Current.Server.MapPath("~/Views/Shared/Mail/_RememberPassword.html")).Replace("{0}","link");
                mailMessage.IsBodyHtml = true;
                smtpClient.Send(mailMessage);

                return new Result { IsTrue = true, Message = "Şifre sıfırlama linkiniz mail adresinize gönderildi." };
            }
            catch (Exception)
            {
                return new Result { IsTrue = false, Message = "Bir hata oluştu" };
            }
        }

Hiç yorum yok:

Yorum Gönder

.net 6 mapget kullanımı

 app.UseEndpoints(endpoints => {     endpoints.MapGet("/", async context =>     {         var response = JsonConvert.Seriali...