Set correct 'My Account' link after changing username

Don't print messages (and the account form) in process_account_form()
anymore, but return them to the caller. When updating accounts, this
function will be called before the headers are written.

If a username has been changed by process_account_form(), the headers
now show the updated username from the database in the 'My Account'
link. Clicking on it immediately after changing a username will no
longer lead to a non-existing URL.

Signed-off-by: Marcel Korpel <marcel.korpel@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
Marcel Korpel 2015-07-19 22:32:06 +02:00 committed by Lukas Fleischer
parent cb9c0d2477
commit 8db2ff5da6
3 changed files with 54 additions and 26 deletions

View file

@ -19,11 +19,20 @@ echo '<div class="box">';
echo '<h2>' . __('Register') . '</h2>';
if (in_request("Action") == "NewAccount") {
process_account_form("new", "NewAccount", in_request("U"), 1, 0,
list($success, $message) = process_account_form(
"new", "NewAccount", in_request("U"), 1, 0,
in_request("E"), '', '', in_request("R"),
in_request("L"), in_request("I"), in_request("K"),
in_request("PK"));
print $message;
if (!$success) {
display_account_form("NewAccount", in_request("U"), 1, 0,
in_request("E"), '', '', in_request("R"),
in_request("L"), in_request("I"), in_request("K"),
in_request("PK"));
}
} else {
print '<p>' . __("Use this form to create an account.") . '</p>';
display_account_form("NewAccount", "", "", "", "", "", "", "", $LANG);