Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add callback URL domain to auth screen #45445

Merged
merged 4 commits into from Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,4 @@
Significance: patch
Type: tweak

Add callback URL domain to auth screen.
15 changes: 8 additions & 7 deletions plugins/woocommerce/includes/class-wc-auth.php
Expand Up @@ -385,19 +385,20 @@ protected function auth_endpoint( $route ) {
wc_get_template(
'auth/form-grant-access.php',
array(
'app_name' => wc_clean( $data['app_name'] ),
'return_url' => add_query_arg(
'app_name' => wc_clean( $data['app_name'] ),
'callback_url' => $this->get_formatted_url( $data['callback_url'] ),
'return_url' => add_query_arg(
array(
'success' => 0,
'user_id' => wc_clean( $data['user_id'] ),
),
$this->get_formatted_url( $data['return_url'] )
),
'scope' => $this->get_i18n_scope( wc_clean( $data['scope'] ) ),
'permissions' => $this->get_permissions_in_scope( wc_clean( $data['scope'] ) ),
'granted_url' => wp_nonce_url( $this->build_url( $data, 'access_granted' ), 'wc_auth_grant_access', 'wc_auth_nonce' ),
'logout_url' => wp_logout_url( $this->build_url( $data, 'login' ) ),
'user' => wp_get_current_user(),
'scope' => $this->get_i18n_scope( wc_clean( $data['scope'] ) ),
'permissions' => $this->get_permissions_in_scope( wc_clean( $data['scope'] ) ),
'granted_url' => wp_nonce_url( $this->build_url( $data, 'access_granted' ), 'wc_auth_grant_access', 'wc_auth_nonce' ),
'logout_url' => wp_logout_url( $this->build_url( $data, 'login' ) ),
'user' => wp_get_current_user(),
)
);
exit;
Expand Down
9 changes: 8 additions & 1 deletion plugins/woocommerce/templates/auth/form-grant-access.php
@@ -1,4 +1,4 @@
<?php

Check notice on line 1 in plugins/woocommerce/templates/auth/form-grant-access.php

View workflow job for this annotation

GitHub Actions / Analyze Branch Changes

TEMPLATES

Version bump found
/**
* Auth form grant access
*
Expand All @@ -12,7 +12,7 @@
*
* @see https://woo.com/document/template-structure/
* @package WooCommerce\Templates\Auth
* @version 4.3.0
* @version 8.8.0
*/

defined( 'ABSPATH' ) || exit;
Expand Down Expand Up @@ -42,6 +42,13 @@
<?php endforeach; ?>
</ul>

<p>
<?php
/* Translators: %s Domain name from the callback URL. */
printf( esc_html__( 'Approving will share credentials with %s. Do not proceed if this looks suspicious in any way.', 'woocommerce' ), '<strong>' . esc_html( wp_parse_url( $callback_url, PHP_URL_HOST ) ) . '</strong>' );
?>
</p>

<div class="wc-auth-logged-in-as">
<?php echo get_avatar( $user->ID, 70 ); ?>
<p>
Expand Down