[aur-dev] [PATCH 1/3] Do not show deletion link on the registration page
In 7df8dc8 (Add support for deleting user accounts, 2014-07-25), a link to the account deletion page was added to the account edit form. Make sure we only show this link if the user actually wants to edit an account and do not show this link on the account registration page. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- web/template/account_edit_form.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/template/account_edit_form.php b/web/template/account_edit_form.php index 3733985..17dd937 100644 --- a/web/template/account_edit_form.php +++ b/web/template/account_edit_form.php @@ -1,8 +1,8 @@ +<?php if ($A == "UpdateAccount"): ?> <p> <?= __('Click %shere%s if you want to permanently delete this account.', '<a href="' . get_user_uri($U) . 'delete/' . '">', '</a>') ?> </p> -<?php if ($A == "UpdateAccount"): ?> <form id="edit-profile-form" action="<?= get_user_uri($U) . 'update/'; ?>" method="post"> <?php else: ?> <form id="edit-profile-form" action="<?= get_uri('/register/'); ?>" method="post"> -- 2.0.3
Pass the right parameters to display_account_form() and process_account_form() when showing/processing the registration form. Fixes a regression introduced in 03c6304 (Rework permission handling, 2014-07-15). Reported-by: Karthik K <hashken.distro@gmail.com> Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- web/html/account.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/html/account.php b/web/html/account.php index d289950..f5ca304 100644 --- a/web/html/account.php +++ b/web/html/account.php @@ -111,10 +111,10 @@ if (isset($_COOKIE["AURSID"])) { # if ($action == "AccountInfo") { print __("You must log in to view user information."); - } elseif ($action == "NewAccount") { + } elseif ($action == "NewAccount") { # process the form input for creating a new account # - process_account_form("","new", "NewAccount", + 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")); @@ -123,7 +123,7 @@ if (isset($_COOKIE["AURSID"])) { # display the account request form # print __("Use this form to create an account."); - display_account_form("", "NewAccount", "", "", "", "", "", "", "", $LANG); + display_account_form("NewAccount", "", "", "", "", "", "", "", $LANG); } } -- 2.0.3
Add a check to remove a notice which is displayed after registration since commit 03c6304 (Rework permission handling, 2014-07-15). Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- web/lib/acctfuncs.inc.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php index 6232f83..d24423f 100644 --- a/web/lib/acctfuncs.inc.php +++ b/web/lib/acctfuncs.inc.php @@ -141,10 +141,13 @@ function process_account_form($TYPE,$A,$U="",$T="",$S="",$E="", $error = __("The PGP key fingerprint is invalid."); } - $atype = account_from_sid($_COOKIE['AURSID']); - if (($atype == "User" && $T > 1) || ($atype == "Trusted User" && $T > 2)) { - $error = __("Cannot increase account permissions."); + if (isset($_COOKIE['AURSID'])) { + $atype = account_from_sid($_COOKIE['AURSID']); + if (($atype == "User" && $T > 1) || ($atype == "Trusted User" && $T > 2)) { + $error = __("Cannot increase account permissions."); + } } + if (!$error && !array_key_exists($L, $SUPPORTED_LANGS)) { $error = __("Language is not currently supported."); } -- 2.0.3
participants (1)
-
Lukas Fleischer