I'm using ASP.NET Identity as membership system in my project. After creating a user I want to check the result and I return the original IdentityResult errors. How can I change these messages?
Thanks.
Update:
public virtual async Task<ActionResult> Register(RegisterViewModel model)
{
if (ModelState.IsValid)
{
var user = new ApplicationUser() { UserName = model.UserName };
var result = await UserManager.CreateAsync(user, model.Password);
if (result.Succeeded)
{
FormsAuthentication.SetAuthCookie(user.UserName, false);
return RedirectToAction("Index", "Home");
}
else
{
AddErrors(result);
}
}
return View(model);
}
private void AddErrors(IdentityResult result)
{
foreach (var error in result.Errors)
{
//I need to change error text message here!
ModelState.AddModelError("", error);
}
}