mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
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 <lfleischer@archlinux.org>
This commit is contained in:
parent
6395a5d5b8
commit
3dbaee80b4
3 changed files with 38 additions and 18 deletions
|
@ -116,23 +116,7 @@ if (isset($_COOKIE["AURSID"])) {
|
||||||
} else {
|
} else {
|
||||||
# visitor is not logged in
|
# visitor is not logged in
|
||||||
#
|
#
|
||||||
if ($action == "AccountInfo") {
|
print __("You must log in to view user information.");
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
|
|
36
web/html/register.php
Normal file
36
web/html/register.php
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
|
||||||
|
|
||||||
|
include_once('aur.inc.php'); # access AUR common functions
|
||||||
|
include_once('acctfuncs.inc.php'); # access Account specific functions
|
||||||
|
|
||||||
|
set_lang(); # this sets up the visitor's language
|
||||||
|
check_sid(); # see if they're still logged in
|
||||||
|
|
||||||
|
if (isset($_COOKIE["AURSID"])) {
|
||||||
|
header('Location: /');
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
html_header(__('Register'));
|
||||||
|
|
||||||
|
echo '<div class="box">';
|
||||||
|
echo '<h2>' . __('Register') . '</h2>';
|
||||||
|
|
||||||
|
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 '</div>';
|
||||||
|
|
||||||
|
html_footer(AURWEB_VERSION);
|
||||||
|
|
||||||
|
?>
|
|
@ -8,7 +8,7 @@ $ROUTES = array(
|
||||||
'/packages' => 'packages.php',
|
'/packages' => 'packages.php',
|
||||||
'/pkgbase' => 'pkgbase.php',
|
'/pkgbase' => 'pkgbase.php',
|
||||||
'/requests' => 'pkgreq.php',
|
'/requests' => 'pkgreq.php',
|
||||||
'/register' => 'account.php',
|
'/register' => 'register.php',
|
||||||
'/account' => 'account.php',
|
'/account' => 'account.php',
|
||||||
'/accounts' => 'account.php',
|
'/accounts' => 'account.php',
|
||||||
'/login' => 'login.php',
|
'/login' => 'login.php',
|
||||||
|
|
Loading…
Add table
Reference in a new issue