Bumped by Community user
    Bumped by Community user
    Bumped by Community user
    Bumped by Community user
2 added 744 characters in body
source | link

First off, I apologize if there is a duplicate of this roaming around somewhere...I have spent the better part of the past hour looking for the solution, with no luck, but maybe I just suck at picking keywords.

Currently working on a frontend profile environment for a client, and one of the options that is being provided is the ability to set and change a password.

One of the things that I cannot seem to find a solid answer for, is whether or not I need to do any security measures for that user-input password, or if the wp_update_user() function has it built in?

I originally thought that I needed to use wp_hash_password on the string that is passed to wp_update_user's user_pass...but that's not working, of course, because it's storing the hashed version as the password into user_pass, and then whatever the user had input becomes useless :P

So...any security tips on how I can "properly" allow users to set and update their passwords from the frontend, without using anything related to the default wordpress dashboard?

Thanks in advance for any help that anyone can provide.

Quick preview of the code for the password portion of the dashboard:

Portion of the php file that takes the user-input password and stores it

I take the password from the form, via AJAX, grab it with $_POST, and then attempt to place it into the database...just making sure whether or not it is this simple, or if there are security measures I need to consider?

$user_data = array(
    'ID'=>$user->ID,
    'user_pass'=>$password
);
wp_update_user($user_data);

form input on the frontend

<input type='password' name='new_password' placeholder='What would you like your password to be?' id='[xxxx-hidden-for-project-anonymity]' style='text-align: center; text-indent: 0;'/>

UPDATE - More specific details, step-by-step planned password input

  1. User is asked to set their password, after having verified their email address.
  2. They put that password into a text input.
  3. On form submit (the password input is the only input in this particular form), I have AJAX in place to take the password from the input to a php function that is connected to WordPress.
  4. After this, it needs to update their password in the database.

I have code that achieves all of the above steps. My question is security. What security measures do I need to implement while the password is taken from the form to the AJAX call, and then measures in the PHP function as it's taken from the function to the database?

First off, I apologize if there is a duplicate of this roaming around somewhere...I have spent the better part of the past hour looking for the solution, with no luck, but maybe I just suck at picking keywords.

Currently working on a frontend profile environment for a client, and one of the options that is being provided is the ability to set and change a password.

One of the things that I cannot seem to find a solid answer for, is whether or not I need to do any security measures for that user-input password, or if the wp_update_user() function has it built in?

I originally thought that I needed to use wp_hash_password on the string that is passed to wp_update_user's user_pass...but that's not working, of course, because it's storing the hashed version as the password into user_pass, and then whatever the user had input becomes useless :P

So...any security tips on how I can "properly" allow users to set and update their passwords from the frontend, without using anything related to the default wordpress dashboard?

Thanks in advance for any help that anyone can provide.

Quick preview of the code for the password portion of the dashboard:

Portion of the php file that takes the user-input password and stores it

I take the password from the form, via AJAX, grab it with $_POST, and then attempt to place it into the database...just making sure whether or not it is this simple, or if there are security measures I need to consider?

$user_data = array(
    'ID'=>$user->ID,
    'user_pass'=>$password
);
wp_update_user($user_data);

form input on the frontend

<input type='password' name='new_password' placeholder='What would you like your password to be?' id='[xxxx-hidden-for-project-anonymity]' style='text-align: center; text-indent: 0;'/>

First off, I apologize if there is a duplicate of this roaming around somewhere...I have spent the better part of the past hour looking for the solution, with no luck, but maybe I just suck at picking keywords.

Currently working on a frontend profile environment for a client, and one of the options that is being provided is the ability to set and change a password.

One of the things that I cannot seem to find a solid answer for, is whether or not I need to do any security measures for that user-input password, or if the wp_update_user() function has it built in?

I originally thought that I needed to use wp_hash_password on the string that is passed to wp_update_user's user_pass...but that's not working, of course, because it's storing the hashed version as the password into user_pass, and then whatever the user had input becomes useless :P

So...any security tips on how I can "properly" allow users to set and update their passwords from the frontend, without using anything related to the default wordpress dashboard?

Thanks in advance for any help that anyone can provide.

Quick preview of the code for the password portion of the dashboard:

Portion of the php file that takes the user-input password and stores it

I take the password from the form, via AJAX, grab it with $_POST, and then attempt to place it into the database...just making sure whether or not it is this simple, or if there are security measures I need to consider?

$user_data = array(
    'ID'=>$user->ID,
    'user_pass'=>$password
);
wp_update_user($user_data);

form input on the frontend

<input type='password' name='new_password' placeholder='What would you like your password to be?' id='[xxxx-hidden-for-project-anonymity]' style='text-align: center; text-indent: 0;'/>

UPDATE - More specific details, step-by-step planned password input

  1. User is asked to set their password, after having verified their email address.
  2. They put that password into a text input.
  3. On form submit (the password input is the only input in this particular form), I have AJAX in place to take the password from the input to a php function that is connected to WordPress.
  4. After this, it needs to update their password in the database.

I have code that achieves all of the above steps. My question is security. What security measures do I need to implement while the password is taken from the form to the AJAX call, and then measures in the PHP function as it's taken from the function to the database?

1
source | link

Frontend Password change

First off, I apologize if there is a duplicate of this roaming around somewhere...I have spent the better part of the past hour looking for the solution, with no luck, but maybe I just suck at picking keywords.

Currently working on a frontend profile environment for a client, and one of the options that is being provided is the ability to set and change a password.

One of the things that I cannot seem to find a solid answer for, is whether or not I need to do any security measures for that user-input password, or if the wp_update_user() function has it built in?

I originally thought that I needed to use wp_hash_password on the string that is passed to wp_update_user's user_pass...but that's not working, of course, because it's storing the hashed version as the password into user_pass, and then whatever the user had input becomes useless :P

So...any security tips on how I can "properly" allow users to set and update their passwords from the frontend, without using anything related to the default wordpress dashboard?

Thanks in advance for any help that anyone can provide.

Quick preview of the code for the password portion of the dashboard:

Portion of the php file that takes the user-input password and stores it

I take the password from the form, via AJAX, grab it with $_POST, and then attempt to place it into the database...just making sure whether or not it is this simple, or if there are security measures I need to consider?

$user_data = array(
    'ID'=>$user->ID,
    'user_pass'=>$password
);
wp_update_user($user_data);

form input on the frontend

<input type='password' name='new_password' placeholder='What would you like your password to be?' id='[xxxx-hidden-for-project-anonymity]' style='text-align: center; text-indent: 0;'/>