Skip to content

Commit ecab2e2

Browse files
committed
cancel request account deletion
1 parent df4cf1a commit ecab2e2

File tree

2 files changed

+31
-14
lines changed

2 files changed

+31
-14
lines changed

resources/lib/UnityUser.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,11 @@ public function requestAccountDeletion(): void
381381
]);
382382
}
383383

384+
public function cancelRequestAccountDeletion(): void
385+
{
386+
$this->SQL->deleteAccountDeletionRequest($this->uid);
387+
}
388+
384389
/**
385390
* Checks if the user has requested account deletion
386391
*/

webroot/panel/account.php

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@
9090
$USER->requestAccountDeletion();
9191
}
9292
break;
93+
case "account_deletion_request_cancel":
94+
$USER->cancelRequestAccountDeletion();
95+
break;
9396
}
9497
}
9598

@@ -245,25 +248,34 @@
245248
if ($hasGroups) {
246249
echo "<p>You cannot request to delete your account while you are in a PI group.</p>";
247250
} else {
248-
echo "
249-
<form
250-
action=''
251-
method='POST'
252-
id='accDel'
253-
onsubmit='return confirm(\"Are you sure you want to request an account deletion?\")'
254-
>
255-
<input type='hidden' name='form_type' value='account_deletion_request' />
256-
";
257251
if ($SQL->accDeletionRequestExists($USER->uid)) {
258-
echo "<input type='submit' value='Request Account Deletion' disabled />";
259252
echo "
260-
<label style='margin-left: 10px'>
261-
Your request has been submitted and is currently pending</label>
253+
<p>Your request has been submitted and is currently pending.</p>
254+
<form
255+
action=''
256+
method='POST'
257+
onsubmit='
258+
return confirm(
259+
\"Are you sure you want to cancel your request for account deletion?\"
260+
)
261+
'
262+
>
263+
<input type='hidden' name='form_type' value='account_deletion_request_cancel' />
264+
<input type='submit' value='Cancel Account Deletion Request' />
265+
</form>
262266
";
263267
} else {
264-
echo "<input type='submit' value='Request Account Deletion' />";
268+
echo "
269+
<form
270+
action=''
271+
method='POST'
272+
onsubmit='return confirm(\"Are you sure you want to request an account deletion?\")'
273+
>
274+
<input type='hidden' name='form_type' value='account_deletion_request' />
275+
<input type='submit' value='Request Account Deletion' />
276+
</form>
277+
";
265278
}
266-
echo "</form>";
267279
}
268280

269281
?>

0 commit comments

Comments
 (0)