public async Task <ActionResult> VerifyPhoneNumber(VerifyPhoneNumberViewModel model) { if (!ModelState.IsValid) { return(View(model)); } var result = await AplicationUserService.ChangePhoneNumberAsync(User.Identity.GetUserId(), model.PhoneNumber, model.Code); if (result.Succeeded) { var user = await AplicationUserService.FindByIdAsync(User.Identity.GetUserId()); if (user != null) { await AplicationSignInService.SignInAsync(user, isPersistent : false, rememberBrowser : false); } return(RedirectToAction("Index", new { Message = ManageMessageId.AddPhoneSuccess })); } // If we got this far, something failed, redisplay form ModelState.AddModelError("", "Failed to verify phone"); return(View(model)); }