【发布时间】:2018-09-19 05:48:24
【问题描述】:
我正在使用 Owin 身份 2.0 通过电子邮件使用两因素身份验证,我在发送电子邮件时遇到问题,因为我的 ApplicationUser 模型具有 UserName 和 Email 属性。如果 UserName 不是电子邮件地址,则代码不会发送到电子邮件地址,但如果 UserName 是电子邮件地址,则其工作正常。 任何可能的解决方案将不胜感激。
if (!ModelState.IsValid)
{
return BadRequest();
}
try
{
if (await SignInManager.SendTwoFactorCodeAsync(model.SelectedProvider))
{
Logger.Info("Email sent to " + model.UserName);
return new { Sent = true };
}
Logger.Info("Email not sent to " + model.UserName);
}
catch (Exception e)
{ Logger.Error(e.Message); }
return new { Sent = false };
【问题讨论】:
标签: c# owin asp.net-identity-2