Tiny Tiny RSS
@@ -726,8 +728,45 @@ class Handler_Public extends Handler {
@$method = $_POST['method'];
- if (!$method) {
- print_notice(__("You will need to provide valid account name and email. New password will be sent on your email address."));
+ if ($hash) {
+ $login = $_REQUEST["login"];
+
+ if ($login) {
+ $result = $this->dbh->query("SELECT id, resetpass_token FROM ttrss_users
+ WHERE login = '$login'");
+
+ if ($this->dbh->num_rows($result) != 0) {
+ $id = $this->dbh->fetch_result($result, 0, "id");
+ $resetpass_token_full = $this->dbh->fetch_result($result, 0, "resetpass_token");
+ list($timestamp, $resetpass_token) = explode(":", $resetpass_token_full);
+
+ if ($timestamp && $resetpass_token &&
+ $timestamp >= time() - 15*60*60 &&
+ $resetpass_token == $hash) {
+
+ $result = $this->dbh->query("UPDATE ttrss_users SET resetpass_token = NULL
+ WHERE id = $id");
+
+ Pref_Users::resetUserPassword($id, true);
+
+ print "
"."Completed."."
";
+
+ } else {
+ print_error("Some of the information provided is missing or incorrect.");
+ }
+ } else {
+ print_error("Some of the information provided is missing or incorrect.");
+ }
+ } else {
+ print_error("Some of the information provided is missing or incorrect.");
+ }
+
+ print "";
+
+ } else if (!$method) {
+ print_notice(__("You will need to provide valid account name and email. A password reset link will be sent to your email address."));
print "