• Resolved niel

    (@nielfernandez)


    Hello, Good day WordPress Developer.

    I need help currently I am working with my database in WordPress table users.
    My project is a collection of lists of information in our team, each member will receive a temporary account they should able to update their password from their custom dashboard what I did is to update their password I give them custom form that I made with HTML/PHP.

    In this part of my codes, I got a problem. Can you help me to solve this?

    * Before they update the password they should confirm the old one but every time I am trying to confirm I received an error.

    <?php 
    //...
    //...
    
    // here my if statement 
    // when I confirm the old password from new one using md5 
    // it return incorrect password. 
         
    if ( md5($_POST["currentPassword"]) == $row['user_pass'] ) 
    {
      
      mysqli_query($connection, " UPDATE wpqu_users SET 
         user_pass = MD5('" . $_POST["newPassword"] . "') 
         WHERE ID = '" . $current_user->ID . "'");        
       
         $message = "Password Changed";
          
       } else {
          
         $message = "Current Password is not correct";
       } 

    Please Thanks for help :))

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    WP does not store passwords as MD5, they are something PHPass creates. It’s related to MD5, but not the same format. You need to use wp_check_password(), which means you need to invoke the WP environment. You cannot easily verify WP password hashes from an external script.

    FWIW, you can store a MD5 hash in the WP password field and WP will verify it matches a hash of the plain text, but it will then update the field to the PHPass version.

    Thread Starter niel

    (@nielfernandez)

    Hello @bcworkz Thank you very much very appreciate your help you save me from trouble.
    Stay Home Keep Safe. ! :))

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Confirm Password WordPress’ is closed to new replies.