Yakın zamanda Asp.Net Identity Core1.0'dan 2.0'a başvuru formumu güncelledim .
Denemek istediğim yeni özellikler var GenerateEmailConfirmationTokenvs.
Bu projeyi referans olarak kullanıyorum .
Kullanıcı kayıt olmaya çalıştığında Register'ın Post metodu çalıştırılırken hata alıyorum
private readonly UserManager<ApplicationUser> _userManager;
public ActionResult Register(RegisterViewModel model)
{
if (ModelState.IsValid)
{
var ifUserEXists = _userManager.FindByName(model.EmailId);
if (ifUserEXists == null) return View(model);
var confirmationToken = _userRepository.CreateConfirmationToken();//this is how i'm generating token currently.
var result = _userRepository.CreateUser(model,confirmationToken);
var user = _userManager.FindByName(model.EmailId);
if (result)
{
var code = _userManager.GenerateEmailConfirmationToken(user.Id);//error here
_userRepository.SendEmailConfirmation(model.EmailId, model.FirstName, confirmationToken);
//Information("An email is sent to your email address. Please follow the link to activate your account.");
return View("~/Views/Account/Thank_You_For_Registering.cshtml");
}
}
//Error("Sorry! email address already exists. Please try again with different email id.");
ModelState.AddModelError(string.Empty, Resource.AccountController_Register_Sorry__User_already_exists__please_try_again_);
return View(model);
}
Çizgide
var code = _userManager.GenerateEmailConfirmationToken(user.Id);
Derken hata alıyorum:
No IUserTokenProvider is registered.
Şimdilik, sadece ne tür bir kod oluşturduğunu görmek istedim. ApplicationUserSınıfımda IdentityUsersınıftan miras alan bazı değişiklikler yapmam gerekiyor mu?
Yoksa bu işlevi çalıştırmak için değiştirmem gereken bir şey mi var?