public async Task <ActionResult> ConfirmContact([FromBody][Required] ConfirmContactContract contract) { if (m_logger.IsEnabled(LogLevel.Information)) { m_logger.LogInformation(GetMethodCalledLoggingString(null, contract)); } var success = false; if (contract.ContactType == ContactTypeEnum.Email) { try { success = await m_identityUserManager.ConfirmEmailAsync(contract.UserId, contract.ConfirmCode); } catch (ConfirmContactException e) { return(Error(e.Error)); } if (success) { var user = await m_identityUserManager.GetUserByIdAsync(contract.UserId); await SetTwoFactorAsync(user, ContactTypeEnum.Email); } } if (contract.ContactType == ContactTypeEnum.Phone) { try { success = await m_identityUserManager.ConfirmPhoneAsync(contract.UserId, contract.ConfirmCode); } catch (ConfirmContactException e) { return(Error(e.Error)); } if (success) { var user = await m_identityUserManager.GetUserByIdAsync(contract.UserId); await SetTwoFactorAsync(user, ContactTypeEnum.Phone); } } return(Json(success)); }
public async Task <bool> ConfirmContactAsync(ConfirmContactContract contract) { var fullPath = $"{BasePath}confirmContact"; return(await m_authorizationServiceHttpClient.SendRequestAsync <bool>(HttpMethod.Post, fullPath, contract)); }