update notifications to make them more visible

cleanup some minor stuff in pref-users
master
Andrew Dolgov 6 years ago
parent 2b54413599
commit ef6d2b8a4e

@ -1051,8 +1051,6 @@ class Handler_Public extends Handler {
$sth->execute([$resetpass_token_full, $login, $email]); $sth->execute([$resetpass_token_full, $login, $email]);
//Pref_Users::resetUserPassword($id, false);
} else { } else {
print_error("User ID not found."); print_error("User ID not found.");
} }

@ -271,18 +271,16 @@ class Pref_Users extends Handler_Protected {
} }
} }
static function resetUserPassword($uid, $show_password) { static function resetUserPassword($uid, $format_output = false) {
$pdo = Db::pdo(); $pdo = Db::pdo();
$sth = $pdo->prepare("SELECT login, email $sth = $pdo->prepare("SELECT login FROM ttrss_users WHERE id = ?");
FROM ttrss_users WHERE id = ?");
$sth->execute([$uid]); $sth->execute([$uid]);
if ($row = $sth->fetch()) { if ($row = $sth->fetch()) {
$login = $row["login"]; $login = $row["login"];
$email = $row["email"];
$new_salt = substr(bin2hex(get_random_bytes(125)), 0, 250); $new_salt = substr(bin2hex(get_random_bytes(125)), 0, 250);
$tmp_user_pwd = make_password(8); $tmp_user_pwd = make_password(8);
@ -294,44 +292,19 @@ class Pref_Users extends Handler_Protected {
WHERE id = ?"); WHERE id = ?");
$sth->execute([$pwd_hash, $new_salt, $uid]); $sth->execute([$pwd_hash, $new_salt, $uid]);
if ($show_password) { $message = T_sprintf("Changed password of user %s to %s", "<strong>$login</strong>", "<strong>$tmp_user_pwd</strong>");
print_notice(T_sprintf("Changed password of user %s to %s", $login, $tmp_user_pwd));
} else {
print_notice(T_sprintf("Sending new password of user %s to %s", $login, $email));
if ($email) {
require_once "lib/MiniTemplator.class.php";
$tpl = new MiniTemplator;
$tpl->readTemplateFromFile("templates/resetpass_template.txt");
$tpl->setVariable('LOGIN', $login);
$tpl->setVariable('NEWPASS', $tmp_user_pwd);
$tpl->addBlock('message');
$message = ""; if ($format_output)
print_notice($message);
$tpl->generateOutputToString($message); else
print $message;
$mailer = new Mailer();
$rc = $mailer->mail(["to_name" => $login,
"to_address" => $email,
"subject" => __("[tt-rss] Password change notification"),
"message" => $message]);
if (!$rc) print_error($mailer->error());
}
}
} }
} }
function resetPass() { function resetPass() {
$uid = clean($_REQUEST["id"]); $uid = clean($_REQUEST["id"]);
Pref_Users::resetUserPassword($uid, true); Pref_Users::resetUserPassword($uid);
} }
function index() { function index() {

@ -127,30 +127,32 @@ body.ttrss_main a:hover {
text-decoration: underline; text-decoration: underline;
} }
body.ttrss_main #notify.visible { body.ttrss_main #notify.visible {
transform: translate(0, -45px); opacity: 100;
} }
body.ttrss_main #notify { body.ttrss_main #notify {
bottom: -45px; bottom: 20px;
right: 0px; right: 20px;
height: 30px; min-width: 200px;
left: 0px; max-width: 350px;
border-width: 1px 0px 0px 0px; border-width: 1px;
border-style: solid; border-style: solid;
position: fixed; position: fixed;
font-size: 13px; font-size: 14px;
z-index: 99; z-index: 99;
display: flex; display: flex;
opacity: 0;
align-items: center; align-items: center;
transition: all 0.5s ease-in-out; padding: 10px;
} transition: opacity 0.2s linear;
body.ttrss_main #notify > * { box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.1);
padding: 4px;
} }
body.ttrss_main #notify img { body.ttrss_main #notify img {
vertical-align: middle; vertical-align: middle;
} }
body.ttrss_main #notify .msg { body.ttrss_main #notify .msg {
flex-grow: 2; flex-grow: 2;
padding: 0 10px;
line-height: 20px;
} }
body.ttrss_main #notify .icon-close { body.ttrss_main #notify .icon-close {
cursor: pointer; cursor: pointer;

File diff suppressed because one or more lines are too long

@ -142,26 +142,25 @@ body.ttrss_main {
} }
#notify.visible { #notify.visible {
transform: translate(0, -45px); opacity: 100;
} }
#notify { #notify {
bottom : -45px; bottom : 20px;
right : 0px; right : 20px;
height : 30px; min-width : 200px;
left : 0px; max-width : 350px;
border-width : 1px 0px 0px 0px; border-width : 1px;
border-style : solid; border-style : solid;
position : fixed; position : fixed;
font-size : 13px; font-size : 14px;
z-index : 99; z-index : 99;
display : flex; display : flex;
opacity: 0;
align-items : center; align-items : center;
transition: all 0.5s ease-in-out; padding : 10px;
transition: opacity 0.2s linear;
> * { box-shadow : 0px 0px 8px rgba(0,0,0,0.1);
padding : 4px;
}
img { img {
vertical-align : middle; vertical-align : middle;
@ -169,6 +168,8 @@ body.ttrss_main {
.msg { .msg {
flex-grow : 2; flex-grow : 2;
padding : 0 10px;
line-height : 20px;
} }
.icon-close { .icon-close {

@ -70,7 +70,7 @@ define(["dojo/_base/declare"], function (declare) {
xhrPost("backend.php", {op: "pref-users", method: "resetPass", id: id}, (transport) => { xhrPost("backend.php", {op: "pref-users", method: "resetPass", id: id}, (transport) => {
Notify.close(); Notify.close();
alert(transport.responseText); Notify.info(transport.responseText, true);
}); });
} }

@ -128,30 +128,32 @@ body.ttrss_main a:hover {
text-decoration: underline; text-decoration: underline;
} }
body.ttrss_main #notify.visible { body.ttrss_main #notify.visible {
transform: translate(0, -45px); opacity: 100;
} }
body.ttrss_main #notify { body.ttrss_main #notify {
bottom: -45px; bottom: 20px;
right: 0px; right: 20px;
height: 30px; min-width: 200px;
left: 0px; max-width: 350px;
border-width: 1px 0px 0px 0px; border-width: 1px;
border-style: solid; border-style: solid;
position: fixed; position: fixed;
font-size: 13px; font-size: 14px;
z-index: 99; z-index: 99;
display: flex; display: flex;
opacity: 0;
align-items: center; align-items: center;
transition: all 0.5s ease-in-out; padding: 10px;
} transition: opacity 0.2s linear;
body.ttrss_main #notify > * { box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.1);
padding: 4px;
} }
body.ttrss_main #notify img { body.ttrss_main #notify img {
vertical-align: middle; vertical-align: middle;
} }
body.ttrss_main #notify .msg { body.ttrss_main #notify .msg {
flex-grow: 2; flex-grow: 2;
padding: 0 10px;
line-height: 20px;
} }
body.ttrss_main #notify .icon-close { body.ttrss_main #notify .icon-close {
cursor: pointer; cursor: pointer;

File diff suppressed because one or more lines are too long

@ -128,30 +128,32 @@ body.ttrss_main a:hover {
text-decoration: underline; text-decoration: underline;
} }
body.ttrss_main #notify.visible { body.ttrss_main #notify.visible {
transform: translate(0, -45px); opacity: 100;
} }
body.ttrss_main #notify { body.ttrss_main #notify {
bottom: -45px; bottom: 20px;
right: 0px; right: 20px;
height: 30px; min-width: 200px;
left: 0px; max-width: 350px;
border-width: 1px 0px 0px 0px; border-width: 1px;
border-style: solid; border-style: solid;
position: fixed; position: fixed;
font-size: 13px; font-size: 14px;
z-index: 99; z-index: 99;
display: flex; display: flex;
opacity: 0;
align-items: center; align-items: center;
transition: all 0.5s ease-in-out; padding: 10px;
} transition: opacity 0.2s linear;
body.ttrss_main #notify > * { box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.1);
padding: 4px;
} }
body.ttrss_main #notify img { body.ttrss_main #notify img {
vertical-align: middle; vertical-align: middle;
} }
body.ttrss_main #notify .msg { body.ttrss_main #notify .msg {
flex-grow: 2; flex-grow: 2;
padding: 0 10px;
line-height: 20px;
} }
body.ttrss_main #notify .icon-close { body.ttrss_main #notify .icon-close {
cursor: pointer; cursor: pointer;

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save