From de07c07fb8ccf7b2f0aedfcabe773630892b4814 Mon Sep 17 00:00:00 2001 From: Francis Pineda Date: Tue, 30 Apr 2024 21:00:51 +0800 Subject: [PATCH] fix: address info parsing default value --- includes/wp-affinidi-login-admin-settings.php | 2 +- includes/wp-affinidi-login-idtoken.php | 16 +++++++++++++++- readme.txt | 2 +- wp-affinidi-login.php | 2 +- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/includes/wp-affinidi-login-admin-settings.php b/includes/wp-affinidi-login-admin-settings.php index 6685d49..c49da63 100644 --- a/includes/wp-affinidi-login-admin-settings.php +++ b/includes/wp-affinidi-login-admin-settings.php @@ -106,7 +106,7 @@ public function options_do_page()
  • Copy the Client ID and Issuer URL and paste it in Step 2 below.
  • Modify the Presentation Definition and ID Token Mapping using this template.

    -

    If you have activated a supported E-Commerce plugin on this WordPress site, use the template for E-Commerce.', 'affinid-login'); ?>

    +

    If you have activated a supported E-Commerce plugin on this WordPress site, use the template for E-Commerce.

  • diff --git a/includes/wp-affinidi-login-idtoken.php b/includes/wp-affinidi-login-idtoken.php index 06776c1..d77fc94 100644 --- a/includes/wp-affinidi-login-idtoken.php +++ b/includes/wp-affinidi-login-idtoken.php @@ -40,13 +40,27 @@ public function extract_contact_info($info) { // get list of countries for transformation include_once(AFFINIDI_PLUGIN_DIR . '/templates/countries-list.php'); + // extract phone number from top level + $phoneNumber = $this->extract_claim($info, 'phone_number'); + // do we have the address info + if (!isset($info['address'])) { + // return empty + return array( + 'address_1' => '', + 'city' => '', + 'state' => '', + 'postcode' => '', + 'country' => '', + 'phone' => $phoneNumber + ); + } + // extract user info $streetAddress = $this->extract_claim($info['address'], 'street_address'); $locality = $this->extract_claim($info['address'], 'locality'); $region = $this->extract_claim($info['address'], 'region'); $postalCode = $this->extract_claim($info['address'], 'postal_code'); $country = $this->extract_claim($info['address'], 'country'); - $phoneNumber = $this->extract_claim($info, 'phone_number'); // get the country code $country = sanitize_text_field(array_search($country, $countries_list)); diff --git a/readme.txt b/readme.txt index 4730811..2197354 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: authentication, passwordless, multi-factor, sso, ecommerce Requires at least: 6.4 Tested up to: 6.5 Requires PHP: 7.4 -Stable tag: 1.1.1 +Stable tag: 1.1.2 License: MIT License URI: https://github.com/affinidi/wordpress-affinidi-login/blob/main/LICENSE diff --git a/wp-affinidi-login.php b/wp-affinidi-login.php index d9576d2..e796703 100644 --- a/wp-affinidi-login.php +++ b/wp-affinidi-login.php @@ -18,7 +18,7 @@ * Plugin Name: Affinidi Login - Passwordless Authentication * Plugin URI: https://github.com/affinidi/wordpress-affinidi-login * Description: A paradigm shift in the registration and sign-in process, Affinidi Login is a game-changing solution for developers. With our revolutionary passwordless authentication solution your user's first sign-in doubles as their registration, and all the necessary data for onboarding can be requested during this streamlined sign-in/signup process. End users are in full control, ensuring that they consent to the information shared in a transparent and user-friendly manner. This streamlined approach empowers developers to create efficient user experiences with data integrity, enhanced security and privacy, and ensures compatibility with industry standards. - * Version: 1.1.1 + * Version: 1.1.2 * Requires at least: 6.4 * Tested up to: 6.5 * Requires PHP: 7.4