Warn about unsalted MD5 hash, use PDO to update Fever password

This commit is contained in:
Grant Pannell
2018-01-22 00:24:30 +10:30
parent 277e173f95
commit c7a6d89c25

View File

@@ -27,6 +27,8 @@ class Fever extends Plugin {
print "<p>" . __("Set a password to login with Fever:") . "</p>";
print "<p><b>" . __("WARNING: The Fever API uses an UNSECURE unsalted MD5 hash. Consider the use of a disposable application-specific password and use HTTPS.") . "</b></p>";
print "<form dojoType=\"dijit.form.Form\">";
print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">
@@ -62,8 +64,9 @@ class Fever extends Plugin {
{
if (isset($_POST["password"]) && isset($_SESSION["uid"]))
{
$result = db_query("SELECT login FROM ttrss_users WHERE id = '" . db_escape_string($_SESSION["uid"]) . "'");
if ($line = db_fetch_assoc($result))
$sth = $this->pdo->prepare("SELECT login FROM ttrss_users WHERE id = ?");
$sth->execute([clean($_SESSION["uid"])]);
if ($line = $sth->fetch())
{
$password = md5($line["login"] . ":" . $_POST["password"]);
$this->host->set($this, "password", $password);