From ef514bc4bd13fc5a05303f4cb065abddd078250e Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 9 Oct 2019 09:04:51 +0300 Subject: add notifications for mail and password changes update and shorten some other message templates --- plugins/auth_internal/init.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'plugins/auth_internal/init.php') diff --git a/plugins/auth_internal/init.php b/plugins/auth_internal/init.php index 8200ddc02..b9c26b3c2 100644 --- a/plugins/auth_internal/init.php +++ b/plugins/auth_internal/init.php @@ -211,6 +211,32 @@ class Auth_Internal extends Plugin implements IAuthModule { $_SESSION["pwd_hash"] = $new_password_hash; + $sth = $this->pdo->prepare("SELECT email, login FROM ttrss_users WHERE id = ?"); + $sth->execute([$owner_uid]); + + if ($row = $sth->fetch()) { + $mailer = new Mailer(); + + require_once "lib/MiniTemplator.class.php"; + + $tpl = new MiniTemplator; + + $tpl->readTemplateFromFile("templates/password_change_template.txt"); + + $tpl->setVariable('LOGIN', $row["login"]); + $tpl->setVariable('TTRSS_HOST', SELF_URL_PATH); + + $tpl->addBlock('message'); + + $tpl->generateOutputToString($message); + + $mailer->mail(["to_name" => $row["login"], + "to_address" => $row["email"], + "subject" => "[tt-rss] Password change notification", + "message" => $message]); + + } + return __("Password has been changed."); } else { return "ERROR: ".__('Old password is incorrect.'); -- cgit v1.2.3-54-g00ecf