예제 #1
0
        public async Task <ActionResult> VerifyPhoneNumber(VerifyPhoneNumberViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var result = await _usuarioAppService.AtualizarTelefone(User.Identity.GetUserId(), model.PhoneNumber, model.Code);

            if (result.Succeeded)
            {
                var user = await _usuarioAppService.ObterUsuario(User.Identity.GetUserId());

                if (user != null)
                {
                    await SignInAsync(user, false);
                }

                return(RedirectToAction("Index", new { Message = ManageMessageId.AddPhoneSuccess }));
            }

            ModelState.AddModelError("", "Falha ao adicionar telefone");

            return(View(model));
        }