OpenSanghaFoundation / OSF

Bug/Feature requests tracking and documentation managament
https://opensanghafoundation.org
0 stars 0 forks source link

A user can't update the password in the account page #38

Closed coiby closed 4 months ago

coiby commented 4 months ago

Describe the bug

A user can't update the password in the account page. And after hitting the "Change Password" button, a user just gets redirected to the Account tab silently.

To Reproduce Steps to reproduce the behavior:

  1. Go to My Account->Change Password
  2. Input current password and new password

Expected behavior A user can log in with a new password.

Additional context

  1. A clean install of WP+UM can't reproduce this issue.
  2. A local install of WP+UM+OFS's database can't reproduce this issue.
  3. When a user successfully changed the password , he/she won't be redirect to the Account tab and a message to indicate the success is shown, Peek 2024-05-17 22-49

Solution

Delete the following code in themes/maxcoach/functions.php,

add_action( 'template_redirect', 'redirect_account_page' );
function redirect_account_page() {
  if (is_page('account') && !isset($_GET['um_action'])) {
    wp_redirect( add_query_arg( 'um_action', 'edit', get_permalink() ) );
    exit();
  }
}

Debugging

Since a local install of WP+UM+OFS's database can't reproduce this issue, I suspect some source code was changed. And since I suspect #17 is related to this issue, I tried to find out which source code file having the message as shown in #17.

I installed String locator – WordPress plugin | WordPress.org to search for text "The username xxx is already taken. Please choose a different one. Or try loging in with default password OSF@2023osf..." and found the message comes from themes/maxcoach/functions.php. I restored this file to the original version and this issue (#38) is gone so we are sure some later-added code to functions.php caused the problem.

I did a bisection and nailed down the problem to redirect_account_page.

OSFOSF commented 4 months ago

i tried and failed to change the users passwordd after changing it here logged out and logged back in with the old password. I was not changed, this page uses the UM short code [ultimatemember_account] as the only thing on the page

OSFOSF commented 4 months ago

password reset button added to the profile menu as a fall back we still need the short code fixed [ultimatemember_account]

coiby commented 4 months ago

Fixed as described in the Solution part of the issue body applied, Screenshot_2024-05-20_20-58-04