Skip to content

Instantly share code, notes, and snippets.

View davidsayre's full-sized avatar

David Sayre davidsayre

  • Allegiance Group
  • Arlington VA
View GitHub Profile
@glye
glye / ezplatform_password_generator.php
Created June 18, 2020 13:28
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");