Skip to content

Commit cc1cf35

Browse files
require ToS for requesting PI group membership in groups.php (#353)
Co-authored-by: Copilot <[email protected]>
1 parent 26a1545 commit cc1cf35

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

test/functional/PIMemberRequestTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ private function requestMembership(string $gid_or_mail)
1010
http_post(__DIR__ . "/../../webroot/panel/groups.php", [
1111
"form_type" => "addPIform",
1212
"pi" => $gid_or_mail,
13+
"tos" => "agree",
1314
]);
1415
}
1516

test/functional/PiMemberApproveTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ private function requestJoinPI(string $gid)
3434
http_post(__DIR__ . "/../../webroot/panel/groups.php", [
3535
"form_type" => "addPIform",
3636
"pi" => $gid,
37+
"tos" => "agree",
3738
]);
3839
}
3940

webroot/panel/groups.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626

2727
switch ($_POST["form_type"]) {
2828
case "addPIform":
29+
if (!isset($_POST["tos"]) || $_POST["tos"] != "agree") {
30+
UnityHTTPD::badRequest("user did not agree to terms of service");
31+
}
2932
if ($pi_account->exists()) {
3033
if ($pi_account->requestExists($USER)) {
3134
array_push($modalErrors, "You've already requested this");

webroot/panel/modal/new_pi.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@
1313
<input type="text" id="pi_search" name="pi" placeholder="Search PI by NetID" required>
1414
<div class="searchWrapper" style="display: none;"></div>
1515
</div>
16+
<label>
17+
<input type='checkbox' name='tos' value='agree' required>
18+
I have read and accept the
19+
<a href='<?php echo CONFIG["site"]["terms_of_service_url"]; ?>' target='_blank'>
20+
Terms of Service
21+
</a>.
22+
</label>
1623
<input type="submit" value="Send Request">
1724
</form>
1825

0 commit comments

Comments
 (0)