Added new .devtools script

This commit is contained in:
Bernd Bestel 2022-12-26 09:11:49 +01:00
parent 79590cd5ac
commit 337cbb73ee
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300

View File

@ -0,0 +1,19 @@
<?php
// This is executed inside DatabaseMigrationService class/context
$db = $this->getDatabaseService()->GetDbConnection();
// Reset the password of the user "admin" to "admin"
$adminUserRow = $db->users()->where('username', 'admin')->fetch();
if ($adminUserRow == null)
{
$adminUserRow = $db->users()->createRow([
'username' => 'admin'
]);
}
$adminUserRow->update([
'password' => password_hash('admin', PASSWORD_DEFAULT)
]);