hellocoop / wordpress

A login and registration WordPress plugin for the Hellō service.
4 stars 2 forks source link

unlinking own account is broken #107

Closed mscurtescu closed 1 year ago

mscurtescu commented 1 year ago

Describe the bug

Clicking "Unlink from Hellō" on the profile page results in an error shown at the top of the page: "Unlink failed: no current user was found"

To Reproduce Steps to reproduce the behavior:

  1. Sign-in with Hellō.
  2. A new linked account is created.
  3. Edit your profile, you should be at /wp-admin/profile.php.
  4. Click "Unlink from Hellō" in the bottom "Hellō" section.
  5. The page is reloaded, you are still linked and notice the error at the top of the page.

Screenshots

image

image

Expected behavior

Account should be unlinked and you should see a success message at the top of the profile page.

image

mscurtescu commented 1 year ago

The bug is most likely caused by a permission check in includes/hello-login-client-wrapper.php:

if ( current_user_can( 'edit_user' ) ) {
...
}
mscurtescu commented 1 year ago

https://github.com/hellocoop/wordpress/commit/0d949174920e4bcedb700be71857cfde4639cb32