1
我有以下功能,在過期的鏈接中重新生成確認電子郵件(以完成註冊)。根據他的用戶ID獲取用戶的電子郵件地址.net身份
[AllowAnonymous]
[HttpGet]
[Route("ResendConfirmationEmail")]
public async Task<IHttpActionResult> ResendConfirmationEmail(string userId = "")
{
if (string.IsNullOrWhiteSpace(userId))
{
ModelState.AddModelError("", "User Id is required");
return BadRequest(ModelState);
}
if (userId.GetHashCode() != null)
{
var code = await UserManager.GenerateEmailConfirmationTokenAsync(userId);
var callbackUrl = new Uri(Url.Link("ConfirmEmailRoute", new { userId, code = code }));
string subject = "Please confirm your account";
string body = "Please confirm your account by clicking this : <a href=\"" + callbackUrl + "\">link</a>";
SendEmail(?????, callbackUrl, subject, body);
}
return Ok();
}
我怎樣才能從webUsers
表中的用戶的電子郵件基於他userid
?
'UserManager'有一個叫做'FindByIdAsync' – tmg