public override async Task NotifyAsync(User user, string token)
        {
            var identityMessage = new IdentityMessage
            {
                Subject = string.Empty,
                Body = $"Your security code is {token}",
                Destination = user.PhoneNumber
            };

            await this.identityMessageService.SendAsync(identityMessage);
        }
Пример #2
0
        public async Task <ActionResult> AddPhoneNumber(AddPhoneNumberViewModel addPhoneNumberViewModel)
        {
            if (this.ModelState.IsValid)
            {
                var userId = this.userIdentityProvider.GetUserId(this.User.Identity);

                var confirmationToken = await this.userIdentityApplicationService.GeneratePhoneNumberConfirmationTokenAsync(userId, addPhoneNumberViewModel.PhoneNumber);

                var identityMessage = new IdentityMessage
                {
                    Destination = addPhoneNumberViewModel.PhoneNumber,
                    Body        = "Your security code is: " + confirmationToken
                };

                await this.userIdentityMessageService.SendAsync(identityMessage);

                return(this.RedirectToAction(nameof(this.VerifyPhoneNumber), new { addPhoneNumberViewModel.PhoneNumber }));
            }

            return(this.View(addPhoneNumberViewModel));
        }