summaryrefslogtreecommitdiff
path: root/plugins/auth_internal
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2019-10-09 09:04:51 +0300
committerAndrew Dolgov <[email protected]>2019-10-09 09:04:51 +0300
commitef514bc4bd13fc5a05303f4cb065abddd078250e (patch)
treea4e19c51e400bc2134cca643448585f5691b24fe /plugins/auth_internal
parentd029e18976649c8fe928f685b9db423310f8f0f9 (diff)
add notifications for mail and password changes
update and shorten some other message templates
Diffstat (limited to 'plugins/auth_internal')
-rw-r--r--plugins/auth_internal/init.php26
1 files changed, 26 insertions, 0 deletions
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.');