|
70 | 70 | } |
71 | 71 | } |
72 | 72 | break; |
| 73 | + case "account_deletion_request": |
| 74 | + $hasGroups = count($USER->getGroups()) > 0; |
| 75 | + if ($hasGroups) { |
| 76 | + die(); |
| 77 | + break; |
| 78 | + } |
| 79 | + if (!$SQL->accDeletionRequestExists($USER->getUID())) { |
| 80 | + $USER->requestAccountDeletion(); |
| 81 | + } |
| 82 | + break; |
73 | 83 | } |
74 | 84 | } |
75 | 85 | ?> |
|
107 | 117 | } |
108 | 118 |
|
109 | 119 | if (!$isPI) { |
110 | | - echo |
111 | | - "<form action='' method='POST' id='piReq' |
112 | | - onsubmit='return confirm(\"Are you sure you want to request a PI account?\")'> |
113 | | - <input type='hidden' name='form_type' value='pi_request'>"; |
114 | | - if ($SQL->requestExists($USER->getUID())) { |
| 120 | + if ($SQL->accDeletionRequestExists($USER->getUID())) { |
| 121 | + echo |
| 122 | + "<form action='' method='POST' id='piReq' |
| 123 | + onsubmit='return confirm(\"Are you sure you want to request a PI account?\")'> |
| 124 | + <input type='hidden' name='form_type' value='pi_request'>"; |
115 | 125 | echo "<input type='submit' value='Request PI Account' disabled>"; |
116 | | - echo "<label style='margin-left: 10px'>Your request has been submitted and is currently pending</label>"; |
| 126 | + echo |
| 127 | + "<label style='margin-left: 10px'> |
| 128 | + You cannot request PI Account while you have requested account deletion. |
| 129 | + </label>"; |
| 130 | + echo "</form>"; |
117 | 131 | } else { |
118 | | - echo "<input type='submit' value='Request PI Account'>"; |
| 132 | + echo |
| 133 | + "<form action='' method='POST' id='piReq' |
| 134 | + onsubmit='return confirm(\"Are you sure you want to request a PI account?\")'> |
| 135 | + <input type='hidden' name='form_type' value='pi_request'>"; |
| 136 | + if ($SQL->requestExists($USER->getUID())) { |
| 137 | + echo "<input type='submit' value='Request PI Account' disabled>"; |
| 138 | + echo "<label style='margin-left: 10px'>Your request has been submitted and is currently pending</label>"; |
| 139 | + } else { |
| 140 | + echo "<input type='submit' value='Request PI Account'>"; |
| 141 | + } |
| 142 | + echo "</form>"; |
119 | 143 | } |
120 | | - echo "</form>"; |
121 | 144 | } |
122 | 145 | ?> |
123 | 146 |
|
|
194 | 217 |
|
195 | 218 | </form> |
196 | 219 |
|
| 220 | +<hr> |
| 221 | + |
| 222 | +<h5>Account Deletion</h5> |
| 223 | +<?php |
| 224 | +$hasGroups = count($USER->getGroups()) > 0; |
| 225 | + |
| 226 | +if ($hasGroups) { |
| 227 | + echo "<p>You cannot request to delete your account while you are in a PI group.</p>"; |
| 228 | +} else { |
| 229 | + echo |
| 230 | + "<form action='' method='POST' id='accDel' |
| 231 | + onsubmit='return confirm(\"Are you sure you want to request an account deletion?\")'> |
| 232 | + <input type='hidden' name='form_type' value='account_deletion_request'>"; |
| 233 | + if ($SQL->accDeletionRequestExists($USER->getUID())) { |
| 234 | + echo "<input type='submit' value='Request Account Deletion' disabled>"; |
| 235 | + echo "<label style='margin-left: 10px'>Your request has been submitted and is currently pending</label>"; |
| 236 | + } else { |
| 237 | + echo "<input type='submit' value='Request Account Deletion'>"; |
| 238 | + } |
| 239 | + echo "</form>"; |
| 240 | +} |
| 241 | + |
| 242 | +?> |
| 243 | + |
| 244 | +<hr> |
| 245 | + |
| 246 | + |
197 | 247 | <script> |
198 | 248 | $("button.btnAddKey").click(function() { |
199 | 249 | openModal("Add New Key", "<?php echo $CONFIG["site"]["prefix"]; ?>/panel/modal/new_key.php"); |
|
0 commit comments