Skip to content

Commit 3ab833c

Browse files
committed
Handle all authorization actions
1 parent d04c82f commit 3ab833c

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

authorize-page.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,19 @@ public function render_page() {
6565
if ( ! empty( $_POST['wp-submit'] ) ) {
6666
check_admin_referer( 'json_oauth1_authorize' );
6767

68-
$authenticator->authorize_request_token( $_REQUEST['oauth_token'] );
69-
exit;
68+
switch ( $_POST['wp-submit'] ) {
69+
case 'authorize':
70+
$authenticator->authorize_request_token( $this->token['key'] );
71+
exit;
72+
73+
case 'cancel':
74+
exit;
75+
76+
default:
77+
$error = new WP_Error( 'json_oauth1_invalid_action', __( 'Invalid authorization action' ), array( 'status' => 400 ) );
78+
$this->display_error( $error );
79+
exit;
80+
}
7081
}
7182

7283
$file = locate_template( 'oauth1-authorize.php' );

0 commit comments

Comments
 (0)