[aur-dev] [PATCH v2 3/3] Set correct 'My Account' link after changing username

Lukas Fleischer lfleischer at archlinux.org
Tue Jul 14 12:02:07 UTC 2015


On Mon, 13 Jul 2015 at 20:01:26, Marcel Korpel wrote:
> This fix uses the POST-Redirect-GET pattern to reload the account
> update page. Output if buffered to be able to send the correct headers
> after the account has been successfully modified.
> 

Thanks for looking into this!

> Signed-off-by: Marcel Korpel <marcel.korpel at gmail.com>
> ---
>  web/html/account.php      | 12 ++++++++++++
>  web/lib/acctfuncs.inc.php |  5 +++--
>  2 files changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/web/html/account.php b/web/html/account.php
> index f5e6c19..d6b12aa 100644
> --- a/web/html/account.php
> +++ b/web/html/account.php
> @@ -19,6 +19,13 @@ if (in_array($action, $need_userinfo)) {
>         $PK = implode("\n", account_get_ssh_keys($row["ID"]));
>  }
>  
> +if (in_request("Update") == "Succeeded") {
> +       $action = "UpdateSucceeded";
> +}
> +

I'd prefer a more general solution, i.e. create a general "confirmation"
action that we can use everywhere else as well.

> +// start output buffering to be able to send headers at a later point

Use C-style comments (/* */) please.

> +ob_start();
> [...]

Can't we easily refactor the current code and move the account
processing before the header is printed?

Regards,
Lukas


More information about the aur-dev mailing list