From a465231effa826f2b98f6aa0517e47f2ba2a22da Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Tue, 20 Sep 2022 10:12:32 +0000 Subject: [PATCH] Account deletion, password reset fixes --- account.php | 81 +++++++++---- app/account/account.php | 212 +++++++++++++++++++++++++++++++++ app/account/password_reset.php | 136 --------------------- app/server/conn.php | 14 ++- css/main.css | 1 + css/main.scss | 2 + password-reset.php | 4 +- 7 files changed, 285 insertions(+), 165 deletions(-) delete mode 100644 app/account/password_reset.php diff --git a/account.php b/account.php index 8e7337f..f47ba5f 100644 --- a/account.php +++ b/account.php @@ -28,7 +28,44 @@

Don't leave! I'm with the science team!

Logout +
+

Be carefull!

+ + + is_admin($conn, $_SESSION['id'])) { ?> @@ -55,7 +92,7 @@
- +
@@ -182,49 +219,51 @@ var confirm_password = $("#userConfirmPassword").val(); var submit = $("#userPasswordSubmit").val(); var userId = $("#userPasswordSubmit").val(); - $("#sniffle").load("app/account/password_reset.php", { + $("#sniffle").load("app/account/account.php", { new_password: new_password, confirm_password: confirm_password, id: userId, - submit: submit + password_reset_submit: submit }); }); } function userDelete(id, username) { var header = "Are you very very sure?"; - var description = "This CANNOT be undone, be very carefull with your decition..."; - var actionBox = "
\ - \ + var description = "This CANNOT be undone, be very carefull with your decition... There is no second warning!"; + var actionBox = "\ + \
\ -
\ - \ + \ + \
"; flyoutShow(header, description, actionBox); - /*$("#descriptionConfirm").submit(function(event) { + $("#userDelete").submit(function(event) { event.preventDefault(); - var descriptionInput = $("#descriptionInput").val(); + var id = $("#userDeleteSubmit").val(); var userDeleteSubmit = $("#userDeleteSubmit").val(); - $("#sniffle").load("path/to/.php", { - id: id, - submit_delete: userDeleteSubmit + $("#sniffle").load("app/account/account.php", { + delete_id: id, + full: false, + account_delete_submit: userDeleteSubmit }); - });*/ - /*$("#descriptionConfirm").submit(function(event) { + }); + $("#userDeleteFull").submit(function(event) { event.preventDefault(); - var descriptionInput = $("#descriptionInput").val(); + var id = $("#userDeleteSubmit").val(); var userDeleteSubmit = $("#userDeleteSubmit").val(); - $("#sniffle").load("path/to/.php", { - id: id, - submit_delete: userDeleteSubmit + $("#sniffle").load("app/account/account.php", { + delete_id: id, + full: true, + account_delete_submit: userDeleteSubmit }); - });*/ + }); } function userToggleAdmin(id, username) { var header = "With great power comes great responsibility..."; var description = "Do you trust this user? With admin permitions they can cause a whole lot of damage to this place, so make sure you're very very sure"; - var actionBox = "
\ + var actionBox = "\ \
"; diff --git a/app/account/account.php b/app/account/account.php index 4269257..2c08129 100644 --- a/app/account/account.php +++ b/app/account/account.php @@ -486,4 +486,216 @@ if (isset($_POST['toggle_admin'])) { + + + + + + + + is_admin($conn, $_SESSION["id"])) { + $user_id = $_POST['id']; + } elseif (empty($_POST['id'])) { + $user_id = $_SESSION["id"]; + } else { + ?> + + + + + + + + + + + + + + + + + + + + - - - - - - - - is_admin($conn, $_SESSION["id"])) { - $user_id = $_POST['id']; - } elseif (empty($_POST['id'])) { - $user_id = $_SESSION["id"]; - } else { - ?> - - - - - - - -