I have access to SFTP and the DB. What's the easiest way to reset my password?
I tried encrypting a new password with bcrypt and dropping it into the DB but that doesn't appear to work.
It's surprisingly hard to find any recent information about this subject.
Reseting admin password
Re: Reseting admin password
Try if this works better:
and ensure the table's hashtype field has value 2 (old 1 would be sha1 that would have to be converted).
Code: Select all
php -r 'echo password_hash("YourPassword", PASSWORD_BCRYPT) . "\n";'
Running s9y at https://erack.net/blog/
Re: Reseting admin password
Thanks for the reply! I ended up creating a php file with the following:
But I assume your solution would also work and might have been faster.
Code: Select all
<?php
$username = "admin-username";
$password = "newpassword";
include 'serendipity_config.inc.php';
echo serendipity_db_query("UPDATE {$serendipity['dbPrefix']}authors SET password = '" . serendipity_hash($password) . "', hashtype=2 WHERE username = '" . serendipity_db_escape_string($username) . "'");
echo "Password changed.";
?>
Re: Reseting admin password
Nice automated solution. The essential part is that serendipity_hash() calls password_hash($string, PASSWORD_BCRYPT).
Now why did I find that now in my snippets collection as well, it must had been published somewhere and I didn't think of.
Anyway, glad it works.
Now why did I find that now in my snippets collection as well, it must had been published somewhere and I didn't think of.
Anyway, glad it works.
Running s9y at https://erack.net/blog/