Skip to content

Instantly share code, notes, and snippets.

@glye
Created June 18, 2020 13:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save glye/f9c757a29b3c5df81416970355d0e8be to your computer and use it in GitHub Desktop.
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.
<?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