Esempio n. 1
0
        public async Task <IActionResult> SifreKurtar([FromBody] SifreKurtarBaslatDto sifreKurtarBaslat)
        {
            return(await HataKontrolluDondur <Task <IActionResult> >(async() =>
            {
                var user = await userManager.KullaniciyiGetirEpostayaGore(sifreKurtarBaslat.Eposta);
                if (user == null || !(await userManager.IsEmailConfirmedAsync(user)))
                {
                    return Ok(Sonuc.Basarisiz(new Exception("Onaylı kullanıcı yok!")));
                }
                if (user.Pasif)
                {
                    return Ok(Sonuc.Basarisiz(new Exception("Onaylı kullanıcı yok!")));
                }


                // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=532713
                // Send an email with this link
                var code = await userManager.GeneratePasswordResetTokenAsync(user);
                var callbackUrl = string.Format("{0}/uyelik/sifresifirla?code={1}", uygulamaAyarlari.JwtIssuer, code);// Url.ResetPasswordCallbackLink(user.Id.ToString(), code, HttpContext.Request.Scheme);


                await postaci.SendEmailAsync(user.Email, $"{user.UserName} için şifre kurtarma epostasi", "Şifre kurtarmaya devam etmek için <a href=\"" + callbackUrl + "\">tıklayınız.</a>");
                return Ok(Sonuc.Tamam);
            }));
        }
Esempio n. 2
0
        public async Task <IActionResult> SifreKurtar([FromBody] SifreKurtarDto sifreKurtar, string returnUrl)
        {
            return(await HataKontrolluDondur <Task <IActionResult> >(async() =>
            {
                var user = await userManager.FindByNameAsync(sifreKurtar.Eposta);
                if (user == null || !(await userManager.IsEmailConfirmedAsync(user)))
                {
                    return Ok();
                }

                // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=532713
                // Send an email with this link
                var code = await userManager.GeneratePasswordResetTokenAsync(user);
                var callbackUrl = Url.Action("ResetPassword", "Account", new { userId = user.Id, code = code }, protocol: HttpContext.Request.Scheme);
                await postaci.SendEmailAsync(user.Email, "Şifre kurtarma",
                                             "Şifre kurtarnaya devam etmek için <a href=\"" + callbackUrl + "\">tıklayınız</a>");
                return Ok();
            }));
        }