diff --git a/classes/handler/public.php b/classes/handler/public.php index 6b588f813..53051a1f8 100644 --- a/classes/handler/public.php +++ b/classes/handler/public.php @@ -708,5 +708,92 @@ class Handler_Public extends Handler { print json_encode(array("error" => array("code" => 7))); } + function forgotpass() { + header('Content-Type: text/html; charset=utf-8'); + print " +
+".__("Completed.")."
"; + + } else { + print_error(__("Sorry, login and email combination not found.")); + print ""; + } + + } else { + print_error(__("Form secret key incorrect. Please enable cookies and try again.")); + print ""; + + } + + } + + print ""; + print ""; + + } + } ?> diff --git a/classes/pref/users.php b/classes/pref/users.php index fbba5e407..b4f043775 100644 --- a/classes/pref/users.php +++ b/classes/pref/users.php @@ -270,11 +270,9 @@ class Pref_Users extends Handler_Protected { } } - function resetPass() { + static function resetUserPassword($link, $uid, $show_password) { - $uid = db_escape_string($this->link, $_REQUEST["id"]); - - $result = db_query($this->link, "SELECT login,email + $result = db_query($link, "SELECT login,email FROM ttrss_users WHERE id = '$uid'"); $login = db_fetch_result($result, 0, "login"); @@ -286,18 +284,20 @@ class Pref_Users extends Handler_Protected { $pwd_hash = encrypt_password($tmp_user_pwd, $new_salt, true); - db_query($this->link, "UPDATE ttrss_users SET pwd_hash = '$pwd_hash', salt = '$new_salt' + db_query($link, "UPDATE ttrss_users SET pwd_hash = '$pwd_hash', salt = '$new_salt' WHERE id = '$uid'"); - print T_sprintf("Changed password of user %s - to %s", $login, $tmp_user_pwd); + if ($show_password) { + print T_sprintf("Changed password of user %s + to %s", $login, $tmp_user_pwd); + } else { + print T_sprintf("Sending new password of user %s + to %s", $login, $email); + } require_once 'lib/phpmailer/class.phpmailer.php'; if ($email) { - print " "; - print T_sprintf("Notifying %s.", $email); - require_once "lib/MiniTemplator.class.php"; $tpl = new MiniTemplator; @@ -340,8 +340,11 @@ class Pref_Users extends Handler_Protected { if (!$rc) print_error($mail->ErrorInfo); } + } - print ""; + function resetPass() { + $uid = db_escape_string($this->link, $_REQUEST["id"]); + Pref_Users::resetUserPassword($this->link, $uid, true); } function index() { diff --git a/include/login_form.php b/include/login_form.php index 68df544e3..af451239d 100644 --- a/include/login_form.php +++ b/include/login_form.php @@ -65,6 +65,20 @@ font-size : 12px; } + a.forgotpass { + text-align : right; + font-size : 11px; + display : inline-block; + } + + a { + color : #4684ff; + } + + a:hover { + color : black; + } + div.footer a { color : gray; } @@ -179,6 +193,8 @@ function bwLimitChange(elem) { "/> + +