Created
June 18, 2020 13:28
-
-
Save glye/f9c757a29b3c5df81416970355d0e8be to your computer and use it in GitHub Desktop.
Generate a new random password for an eZ Platform user. You have to run the SQL update statement yourself, with the correct user ID.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Generate a new random password for an eZ Platform user. You have to run the SQL update statement yourself, with the correct user ID. | |
$password = bin2hex(random_bytes(8)); // 16-char hex password | |
print("New password: $password\n"); | |
$hash = password_hash($password, PASSWORD_DEFAULT); // this is bcrypt, for now | |
print("New password hash: $hash\n"); | |
print("Update SQL:\nUPDATE ezuser SET password_hash = '$hash', password_hash_type = 7 WHERE contentobject_id = INSERT YOUR ID HERE, ADMIN IS 14;\n"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment