From 3dbaee80b4fcc99cd236f76e60a1572377946123 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Thu, 25 Jun 2015 15:46:39 +0200 Subject: Move registration code to a separate unit Until now, we used the same unit to register and edit accounts. Split these features into separate source files for clarity. This also allows us to redirect to the home page when a logged-in user tries to access the registration page. Signed-off-by: Lukas Fleischer --- web/html/account.php | 18 +----------------- web/html/register.php | 36 ++++++++++++++++++++++++++++++++++++ web/lib/routing.inc.php | 2 +- 3 files changed, 38 insertions(+), 18 deletions(-) create mode 100644 web/html/register.php diff --git a/web/html/account.php b/web/html/account.php index 6ecd56e..0bb145c 100644 --- a/web/html/account.php +++ b/web/html/account.php @@ -116,23 +116,7 @@ if (isset($_COOKIE["AURSID"])) { } else { # visitor is not logged in # - if ($action == "AccountInfo") { - print __("You must log in to view user information."); - } elseif ($action == "NewAccount") { - # process the form input for creating a new account - # - 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")); - - } else { - # display the account request form - # - print __("Use this form to create an account."); - display_account_form("NewAccount", "", "", "", "", "", "", "", $LANG); - } + print __("You must log in to view user information."); } echo ""; diff --git a/web/html/register.php b/web/html/register.php new file mode 100644 index 0000000..014d802 --- /dev/null +++ b/web/html/register.php @@ -0,0 +1,36 @@ +'; +echo '

' . __('Register') . '

'; + +if (in_request("Action") == "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"), + in_request("PK")); + +} else { + print __("Use this form to create an account."); + display_account_form("NewAccount", "", "", "", "", "", "", "", $LANG); +} + +echo ''; + +html_footer(AURWEB_VERSION); + +?> diff --git a/web/lib/routing.inc.php b/web/lib/routing.inc.php index 74ab816..8c45c62 100644 --- a/web/lib/routing.inc.php +++ b/web/lib/routing.inc.php @@ -8,7 +8,7 @@ $ROUTES = array( '/packages' => 'packages.php', '/pkgbase' => 'pkgbase.php', '/requests' => 'pkgreq.php', - '/register' => 'account.php', + '/register' => 'register.php', '/account' => 'account.php', '/accounts' => 'account.php', '/login' => 'login.php', -- cgit v1.2.3-54-g00ecf