コード例 #1
0
        public async Task <IActionResult> ConfirmPost(ConfirmModel model)
        {
            if (ModelState.IsValid)
            {
                var user = await _userManager.FindByEmailAsync(model.Email);

                if (user == null)
                {
                    ModelState.AddModelError("User", "User with given email address was not found!");
                    return(View(model));
                }
                //Name is required field
                var result = await _userManager.ConfirmEmailAsync(user, model.Code);

                if (result.Succeeded)
                {
                    return(RedirectToAction("Index", "Home"));
                }
                else
                {
                    foreach (var item in result.Errors)
                    {
                        ModelState.AddModelError(item.Code, item.Description);
                    }
                }
            }
            return(View(model));
        }
コード例 #2
0
 public IActionResult Confirm(ConfirmModel model)
 {
     return(View(model));
 }