Exemplo n.º 1
0
        public async Task <IActionResult> AddPhoneNumber(AddPhoneNumberViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            // Generate the token and send it
            var user = await userManager.FindByIdAsync(HttpContext.User.GetUserId());

            var code = await userManager.GenerateChangePhoneNumberTokenAsync(user, model.Number);

            await smsSender.SendSmsAsync(model.Number, "Your security code is: " + code);

            return(RedirectToAction("VerifyPhoneNumber", new { PhoneNumber = model.Number }));
        }