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

Copy over nonce from parsed POST vars to parsed GET vars as a temp fix #36

Merged
merged 6 commits into from
Sep 23, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Http/Handlers/AuthorizeHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public function handle( Request $request, Response $response ): Response {

$user = wp_get_current_user();
if ( $this->consent_storage->needs_consent( $user->ID ) ) {
if ( ! isset( $_POST['authorize'] ) || 'Authorize' !== $_POST['authorize'] ) {
// phpcs:disable WordPress.Security.NonceVerification.Recommended -- We already have REST API nonce validating the user intention with this request
if ( ! isset( $_REQUEST['authorize'] ) || 'Authorize' !== $_REQUEST['authorize'] ) {
$response->send();
exit;
}
Expand Down
2 changes: 1 addition & 1 deletion templates/authenticate/form.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php /** @var stdClass $data */ ?>

<form method="post" action="<?php echo esc_url( $data->form_url ); ?>">
<form method="GET" action="<?php echo esc_url( $data->form_url ); ?>">
ashfame marked this conversation as resolved.
Show resolved Hide resolved
<?php wp_nonce_field( 'wp_rest' ); /* The nonce will give the REST call the userdata. */ ?>
<?php foreach ( $data->form_fields as $key => $value ) : ?>
<input type="hidden" name="<?php echo esc_attr( $key ); ?>" value="<?php echo esc_attr( $value ); ?>"/>
Expand Down