Warn about unsalted MD5 hash, use PDO to update Fever password
This commit is contained in:
@@ -27,6 +27,8 @@ class Fever extends Plugin {
|
|||||||
|
|
||||||
print "<p>" . __("Set a password to login with Fever:") . "</p>";
|
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 "<form dojoType=\"dijit.form.Form\">";
|
||||||
|
|
||||||
print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">
|
print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">
|
||||||
@@ -62,8 +64,9 @@ class Fever extends Plugin {
|
|||||||
{
|
{
|
||||||
if (isset($_POST["password"]) && isset($_SESSION["uid"]))
|
if (isset($_POST["password"]) && isset($_SESSION["uid"]))
|
||||||
{
|
{
|
||||||
$result = db_query("SELECT login FROM ttrss_users WHERE id = '" . db_escape_string($_SESSION["uid"]) . "'");
|
$sth = $this->pdo->prepare("SELECT login FROM ttrss_users WHERE id = ?");
|
||||||
if ($line = db_fetch_assoc($result))
|
$sth->execute([clean($_SESSION["uid"])]);
|
||||||
|
if ($line = $sth->fetch())
|
||||||
{
|
{
|
||||||
$password = md5($line["login"] . ":" . $_POST["password"]);
|
$password = md5($line["login"] . ":" . $_POST["password"]);
|
||||||
$this->host->set($this, "password", $password);
|
$this->host->set($this, "password", $password);
|
||||||
|
|||||||
Reference in New Issue
Block a user