Пример #1
0
        public async Task <IActionResult> ResetPassword([FromBody] SifreKurtarDto model)
        {
            return(await HataKontrolluDondur <Task <IActionResult> >(async() =>
            {
                var user = await userManager.FindByEmailAsync(model.Eposta);
                if (user == null)
                {
                    return NotFound("Kullanıcı yok!");
                }
                var result = await userManager.ResetPasswordAsync(user, model.Kod, model.Sifre);
                if (result.Succeeded)
                {
                    return Ok(Sonuc.Tamam);
                }

                return Ok(Sonuc.Basarisiz(new Exception("Şifre değişmedi! Değiştirme süreniz bitmiş olabilir. Süreci yeniden başlatı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();
            }));
        }