関数
LoginWithAmazon::loginWithAmazonCheckoutSession()
Login to Welcart with Amazon account email.
説明 説明
This is only possible if the user has previously registered with their Amazon account. Forcing a login without first checking whether the account was registered via an Amazon account is a security risk. Forcing a login with only an email match could allow someone to create an Amazon account with the email of the person whose Welcart account they want to highjack and then login with Amazon on a Welcart site to gain access to said persons info.
ファイル: src/API/LoginWithAmazon.php
public function loginWithAmazonCheckoutSession() { return function () { global $wpdb; if (usces_is_login()) { return; } if (empty($_REQUEST['amazonCheckoutSessionId'])) { return; } $sessionId = $_REQUEST['amazonCheckoutSessionId']; $result = (new CheckoutSession\Get($this->module))->get($sessionId); if ($result instanceof GenericError) { return; } $response = json_decode($result['response'], true); $email = $response['buyer']['email']; $member_table = $wpdb->prefix . 'usces_member'; $query = $wpdb->prepare("SELECT ID FROM $member_table WHERE mem_email = %s", $email); $id = $wpdb->get_var($query); if (empty($id)) { return; } $amzmeta = new MemberMeta($id); if (!$amzmeta->getAllowAmazonToWelcartLogin()) { return; } $this->executeLogin($email); /** * Mirrored Welcart action hook * * @ignore */ do_action('usces_action_after_login'); }; }