Function change_user_password

Source
pub async fn change_user_password<'a>(
    virtual_file_system: &'a VirtualFileSystem<'a>,
    user_name: &str,
    new_password: &str,
) -> Result<()>
Expand description

Changes a user’s password by generating a new salt and hash.

This function updates a user’s password by:

  1. Generating a new random salt
  2. Hashing the new password with the salt
  3. Reading the existing user file
  4. Updating the hash and salt fields
  5. Writing the updated data back to the file

§Arguments

  • Virtual_file_system - Reference to the virtual file system
  • User_name - Username of the account to update
  • New_password - New plain text password

§Returns

Returns Ok(()) if the password was changed successfully, or an appropriate error if the operation fails.

§Errors

  • File system errors (opening, reading, writing user file)
  • Salt generation failures
  • JSON parsing errors