Skip to content

Commit b85fc07

Browse files
committed
Some fixups
Use UnitySite::redirect instead of doing it ourselves Move special logic from UnitySite::redirect to header.php Fix PI checkbox being required by default
1 parent 5b6773d commit b85fc07

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

resources/lib/UnitySite.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@ public static function die($x = null)
2626

2727
public static function redirect($destination)
2828
{
29-
if ($_SERVER["PHP_SELF"] != $destination) {
30-
header("Location: $destination");
31-
self::die("Redirect failed, click <a href='$destination'>here</a> to continue.");
32-
}
29+
header("Location: $destination");
30+
die("Redirect failed, click <a href='$destination'>here</a> to continue.");
3331
}
3432

3533
private static function headerResponseCode(int $code, string $reason)

resources/templates/header.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
}
1212

1313
if (isset($SSO)) {
14-
if (!$_SESSION["user_exists"]) {
14+
if (!$_SESSION["user_exists"] && !str_ends_with($_SERVER['PHP_SELF'], "/panel/new_account.php")) {
1515
UnitySite::redirect($CONFIG["site"]["prefix"] . "/panel/new_account.php");
1616
}
1717
}

webroot/panel/new_account.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@
3939
$form_group->newUserRequest($USER);
4040
}
4141
}
42-
header("Location: {$_SERVER['PHP_SELF']}");
43-
UnitySite::die();
42+
UnitySite::redirect($_SERVER['PHP_SELF']);
4443
}
4544

4645
if (isset($_GET['cancel']) && count($pending_requests) > 0) {
@@ -56,8 +55,7 @@
5655
$pi_group->cancelGroupJoinRequest($user=$USER);
5756
}
5857
}
59-
header("Location: {$_SERVER['PHP_SELF']}");
60-
UnitySite::die();
58+
UnitySite::redirect($_SERVER['PHP_SELF']);
6159
}
6260

6361
?>
@@ -74,7 +72,7 @@
7472
echo "<p>Requesting a PI account</p>";
7573
echo "<p>You will receive an email when your account has been approved.</p>";
7674
echo "<p>Email <a href=\"mailto:{$CONFIG['mail']['support']}\">{$CONFIG['mail']['support_name']}</a>";
77-
echo "if you have not heard back in one business day. </p>";
75+
echo " if you have not heard back in one business day. </p>";
7876
} else {
7977
$owner_uid = UnityGroup::getUIDfromPIUID($pi_uid);
8078
echo "<p>Joining existing group owned by " . $owner_uid . "</p>";
@@ -100,7 +98,7 @@
10098

10199
<label><input type='radio' name='new_user_sel' value='pi'>Request a PI account</label>
102100
<div style='position: relative;display: none;' id='piConfirmWrapper'>
103-
<label><input type='checkbox' id='chk_pi' name='confirm_pi' value='agree' required>
101+
<label><input type='checkbox' id='chk_pi' name='confirm_pi' value='agree'>
104102
I have read the PI <a href="<?php echo $CONFIG["site"]["account_policy_url"]; ?>">
105103
account policy</a> guidelines. </label>
106104
</div>

0 commit comments

Comments
 (0)