prevent users without confirmed email from logging in ASP.Net MVC with Identity 2

前端 未结 6 1145
遥遥无期
遥遥无期 2020-12-29 08:28

In microsoft Identity 2 there is ability to users can confirm there email addresses I downloaded Identity 2 sample project from here in this project there isn\'t any differ

6条回答
  •  天命终不由人
    2020-12-29 09:05

    Instead of moving to another page, why not finish this one and redirect to the right action / view:

    if (!await UserManager.IsEmailConfirmedAsync(user.Id))
    {
        return RedirectToAction("ConfirmEmailAddress", new { ReturnUrl = returnUrl });
    }
    

    You do need an action (and possibly a view) with the name ConfirmEmailAddress though.

提交回复
热议问题