-
Notifications
You must be signed in to change notification settings - Fork 156
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
WooCommerce shop_manager cannot setup TOTP for her user: 403 rest_forbidden for /wp-json/two-factor/1.0/totp #557
Comments
Via https://woocommerce.com/document/roles-capabilities/#section-2 I found a list of all the capabilities assigned to the Shop Manager role at https://github.com/woocommerce/woocommerce/blob/ee01d4219282387c2975ef4594677453c1dd7a0e/includes/class-wc-install.php#L1052 Not sure what is missing for |
Thanks for reporting this issue @gerdneuman The capability that I believe the user is missing is It looks like WooCommerce overrides this Huh, confirmed.. but it's not a string. It's a float. The rest api forces it into a Ways forward:
This affects Backup/Recovery Codes and TOTP. |
current_user_can() expects user_id to be integer Fixes WordPress#559 Fixes WordPress#557
Describe the bug
A user with role
shop_manager
is not able to setup TOTP, because the background network POST request to/wp-json/two-factor/1.0/totp
fails with403 Forbidden
error. It works for a wordpress admin user. I tested on Live and Test server. As it works for the admin user, I am pretty sure it is not related to Apache but a capabilities or permission issue.Any idea what capability is missing here?
Steps to Reproduce
Steps to reproduce:
Actual results:
An error message is displayed saying:
Browser DevTools Tab shows a network POST to
https://mysite.test/wp-json/two-factor/1.0/totp
that fails with403 forbidden
:Expected results:
TOTP should work as for admin user. FWIW, it works also if the admin user sets up and saves TOTP for the shopmanager user.
Screenshots, screen recording, code snippet
No response
Environment information
WordPress, WooCommerce and Two Factor all with latest up-to-date versions.
From the WooCommerce status page:
Please confirm that you have searched existing issues in this repository.
Yes
Please confirm that you have tested with all plugins deactivated except Two-Factor.
Yes
The text was updated successfully, but these errors were encountered: