Files
wc-bootstrap/templates/auth/form-grant-access.html.twig

73 lines
2.4 KiB
Twig
Raw Permalink Normal View History

{#
# REST API Auth Grant Access Form (Bootstrap 5 Override)
#
# Confirmation page for granting third-party app access via OAuth.
# Rendered outside the WordPress theme (standalone page).
#
# Expected context:
# app_name - Name of the requesting application
# scope - Access scope (read, write, read_write)
# permissions - Array of permission description strings
# callback_url - Callback URL for the application
# return_url - URL to return to on deny
# granted_url - URL to redirect to on approve
# logout_url - URL to log out
# user - WP_User object of the logged-in user
#
# WooCommerce PHP equivalent: auth/form-grant-access.php
#
# @package WcBootstrap
# @since 0.1.0
#}
{{ do_action('woocommerce_auth_page_header') }}
<h1 class="h3 mb-4">
{{ __('%s would like to connect to your store')|format(app_name|esc_html) }}
</h1>
{{ wc_print_notices() }}
<p class="mb-3">
{{ __('This will give "%1$s" %2$s access which will allow it to:')|format(
'<strong>' ~ app_name|esc_html ~ '</strong>',
'<strong>' ~ scope|esc_html ~ '</strong>'
)|wp_kses_post }}
</p>
<ul class="list-group mb-4">
{% for permission in permissions %}
<li class="list-group-item">
<i class="bi bi-check-lg text-success me-2" aria-hidden="true"></i>
{{ permission|esc_html }}
</li>
{% endfor %}
</ul>
<div class="alert alert-warning mb-4" role="alert">
<i class="bi bi-exclamation-triangle me-2" aria-hidden="true"></i>
{{ __('Approving will share credentials with %s. Do not proceed if this looks suspicious in any way.')|format(
'<strong>' ~ wp_parse_url(callback_url, constant('PHP_URL_HOST'))|esc_html ~ '</strong>'
)|wp_kses_post }}
</div>
<div class="d-flex align-items-center gap-3 mb-4 p-3 bg-body-tertiary rounded">
{{ get_avatar(user.ID, 48)|raw }}
<div>
<span class="fw-semibold">{{ __('Logged in as %s')|format(user.display_name|esc_html) }}</span>
<a href="{{ logout_url|esc_url }}" class="d-block small">{{ __('Logout') }}</a>
</div>
</div>
<div class="d-flex gap-2">
<a href="{{ granted_url|esc_url }}" class="btn btn-primary">
<i class="bi bi-check-lg me-1" aria-hidden="true"></i>
{{ __('Approve') }}
</a>
<a href="{{ return_url|esc_url }}" class="btn btn-outline-secondary">
{{ __('Deny') }}
</a>
</div>
{{ do_action('woocommerce_auth_page_footer') }}