Esempio n. 1
0
        public async Task <IdentityResult> SetPhoneNumberAndCountryAsync(User user, string phoneNumber, string countryCallingCode, CancellationToken cancellationToken)
        {
            var result = await _smsProvider.ValidateNumberAsync(phoneNumber, countryCallingCode, cancellationToken);

            if (string.IsNullOrEmpty(result.phoneNumber))
            {
                return(IdentityResult.Failed(new IdentityError()
                {
                    Code = "InvalidPhoneNumber",
                    Description = "InvalidPhoneNumber"
                }));
            }

            user.ChangeCountry(result.country);
            return(await SetPhoneNumberAsync(user, result.phoneNumber));
        }