Skip to content

Commit

Permalink
Use the integer REST API type instead of number, to resolve overly st…
Browse files Browse the repository at this point in the history
…rict user_id capability checks (#560)

* Fixing bug where Super Admins cannot setup Time Based One-Time Password as first Two Factor option on WP VIP
* refactor(Two_Factor_Backup_Codes): setting user_id type to integer instead of number to make consistent with Two_Factor_Totp

Fixes #559
Fixes #557
  • Loading branch information
spenserhale authored May 2, 2023
1 parent bb96a02 commit c725c9b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion providers/class-two-factor-backup-codes.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function register_rest_routes() {
'args' => array(
'user_id' => array(
'required' => true,
'type' => 'number',
'type' => 'integer',
),
'enable_provider' => array(
'required' => false,
Expand Down
6 changes: 3 additions & 3 deletions providers/class-two-factor-totp.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function register_rest_routes() {
'args' => array(
'user_id' => array(
'required' => true,
'type' => 'number',
'type' => 'integer',
),
),
),
Expand All @@ -83,7 +83,7 @@ public function register_rest_routes() {
'args' => array(
'user_id' => array(
'required' => true,
'type' => 'number',
'type' => 'integer',
),
'key' => array(
'type' => 'string',
Expand Down Expand Up @@ -223,7 +223,7 @@ public static function generate_qr_code_url( $user, $secret_key ) {

/**
* Filter the Label for the TOTP.
*
*
* Must follow the TOTP format for a "label". Do not URL Encode.
*
* @see https://github.com/google/google-authenticator/wiki/Key-Uri-Format#label
Expand Down

0 comments on commit c725c9b

Please sign in to comment.