Skip to content

Commit 5b6773d

Browse files
committed
Add new config option for account policy
Require confirmation of account policy for PI requests
1 parent b362aae commit 5b6773d

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

defaults/config.ini.default

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ url = "https://127.0.0.1:8000/" ; URL of the website
1212
description = "The Unity Web Portal is a lightweight HPC cluster front-end" ; Description of the website
1313
logo = "logo.png" ; path to logo file, in the webroot/assets/branding folder
1414
terms_of_service_url = "https://github.com" ; this can be external or a portal page created with "content management"
15+
account_policy_url = "https://github.com" ; this can be external or a portal page created with "content management"
1516

1617
[ldap]
1718
uri = "ldap://identity" ; URI of remote LDAP server

webroot/panel/new_account.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
// Request Account Form was Submitted
3030
if (count($errors) == 0) {
3131
if ($_POST["new_user_sel"] == "pi") {
32+
if (!isset($_POST["chk_pi"]) || $_POST["chk_pi"] != "agree") {
33+
// checkbox was not checked
34+
array_push($errors, "Please confirm you have read the account policy guidelines.");
35+
}
3236
// requesting a PI account
3337
$USER->getPIGroup()->requestGroup($SEND_PIMESG_TO_ADMINS);
3438
} elseif ($_POST["new_user_sel"] == "not_pi") {
@@ -94,7 +98,12 @@
9498

9599
<hr>
96100

97-
<label><input type='radio' name='new_user_sel' value='pi'>Request a PI account (I am a PI)</label>
101+
<label><input type='radio' name='new_user_sel' value='pi'>Request a PI account</label>
102+
<div style='position: relative;display: none;' id='piConfirmWrapper'>
103+
<label><input type='checkbox' id='chk_pi' name='confirm_pi' value='agree' required>
104+
I have read the PI <a href="<?php echo $CONFIG["site"]["account_policy_url"]; ?>">
105+
account policy</a> guidelines. </label>
106+
</div>
98107
<br>
99108
<label><input type='radio' name='new_user_sel' value='not_pi' checked>Join an existing PI group</label>
100109

@@ -126,12 +135,17 @@
126135

127136
<script>
128137
$('input[type=radio][name=new_user_sel]').change(function() {
138+
let pi_cnf_text = $('#piConfirmWrapper');
129139
let pi_sel_text = $('#piSearchWrapper');
130140
if (this.value == 'not_pi') {
141+
pi_cnf_text.hide();
131142
pi_sel_text.show();
143+
$("#chk_pi").prop("required", false);
132144
$("#pi_search").prop("required", true);
133145
} else if (this.value == 'pi') {
146+
pi_cnf_text.show();
134147
pi_sel_text.hide();
148+
$("#chk_pi").prop("required", true);
135149
$("#pi_search").prop("required", false);
136150
}
137151
});

0 commit comments

Comments
 (0)