simplify some public.php prompts; prevent from submitting forgotpass form repeatedly if check succeeds

This commit is contained in:
Andrew Dolgov 2019-02-21 12:50:15 +03:00
parent 039bf24835
commit d60038d48b
1 changed files with 11 additions and 23 deletions

View File

@ -844,9 +844,7 @@ class Handler_Public extends Handler {
} }
} }
print "<form method='get' action='index.php'> print "<a href='index.php'>".__("Return to Tiny Tiny RSS")."</a>";
<button type='submit' dojoType='dijit.form.Button'>".__("Return to Tiny Tiny RSS")."</button>
</form>";
print "</div></div></body></html>"; print "</div></div></body></html>";
@ -935,11 +933,7 @@ class Handler_Public extends Handler {
print_error("Some of the information provided is missing or incorrect."); print_error("Some of the information provided is missing or incorrect.");
} }
print "<hr/>"; print "<a href='index.php'>".__("Return to Tiny Tiny RSS")."</a>";
print "<form method='GET' action='index.php'>
<button type='submit' class='alt-primary' dojoType='dijit.form.Button'>".__("Return to Tiny Tiny RSS")."</button>
</form>";
} else if (!$method) { } else if (!$method) {
print_notice(__("You will need to provide valid account name and email. Password reset link will be sent to your email address.")); print_notice(__("You will need to provide valid account name and email. Password reset link will be sent to your email address."));
@ -989,6 +983,10 @@ class Handler_Public extends Handler {
} else { } else {
// prevent submitting this form multiple times
$_SESSION["pwdreset:testvalue1"] = rand(1, 1000);
$_SESSION["pwdreset:testvalue2"] = rand(1, 1000);
$sth = $this->pdo->prepare("SELECT id FROM ttrss_users $sth = $this->pdo->prepare("SELECT id FROM ttrss_users
WHERE login = ? AND email = ?"); WHERE login = ? AND email = ?");
$sth->execute([$login, $email]); $sth->execute([$login, $email]);
@ -1041,9 +1039,7 @@ class Handler_Public extends Handler {
print_error("User ID not found."); print_error("User ID not found.");
} }
print "<form method='GET' action='index.php'> print "<a href='index.php'>".__("Return to Tiny Tiny RSS")."</a>";
<button dojoType='dijit.form.Button' type='submit' class='alt-primary'>".__("Return to Tiny Tiny RSS")."</button>
</form>";
} else { } else {
print_error(__("Sorry, login and email combination not found.")); print_error(__("Sorry, login and email combination not found."));
@ -1136,9 +1132,7 @@ class Handler_Public extends Handler {
print_warning("One of the updates failed. Either retry the process or perform updates manually."); print_warning("One of the updates failed. Either retry the process or perform updates manually.");
print "<form method='GET' action='index.php'> print "<a href='index.php'>".__("Return to Tiny Tiny RSS")."</a>";
<button dojoType='dijit.form.Button' type='submit' class='alt-primary'>".__("Return to Tiny Tiny RSS")."</button>
</form>";
return; return;
} else { } else {
@ -1150,16 +1144,12 @@ class Handler_Public extends Handler {
print_notice("Your Tiny Tiny RSS database is now updated to the latest version."); print_notice("Your Tiny Tiny RSS database is now updated to the latest version.");
print "<form method='GET' action='index.php'> print "<a href='index.php'>".__("Return to Tiny Tiny RSS")."</a>";
<button dojoType='dijit.form.Button' type='submit' class='alt-primary'>".__("Return to Tiny Tiny RSS")."</button>
</form>";
} else { } else {
print_notice("Tiny Tiny RSS database is up to date."); print_notice("Tiny Tiny RSS database is up to date.");
print "<form method='GET' action='index.php'> print "<a href='index.php'>".__("Return to Tiny Tiny RSS")."</a>";
<button dojoType='dijit.form.Button' type='submit' class='alt-primary'>".__("Return to Tiny Tiny RSS")."</button>
</form>";
} }
} else { } else {
if ($updater->isUpdateRequired()) { if ($updater->isUpdateRequired()) {
@ -1182,9 +1172,7 @@ class Handler_Public extends Handler {
print_notice("Tiny Tiny RSS database is up to date."); print_notice("Tiny Tiny RSS database is up to date.");
print "<form method='GET' action='index.php'> print "<a href='index.php'>".__("Return to Tiny Tiny RSS")."</a>";
<button dojoType='dijit.form.Button' class='alt-primary' type='submit'>".__("Return to Tiny Tiny RSS")."</button>
</form>";
} }
} }
?> ?>