From 60f0877a5c965a71defc927bee5b10b9a0dda4e2 Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Wed, 9 Nov 2022 12:13:38 +0000 Subject: [PATCH] Fixed password reset bug Added logs for password resets Added checks to sanity --- account.php | 142 ++++++++++++++++++++++++------------- app/account/account.php | 7 +- app/gallery.json | 2 +- app/sanity/check/_json.php | 20 ++++-- app/sanity/sanity.php | 6 +- css/main.css | 32 +++------ css/scss/_body.scss | 47 ++++-------- image.php | 2 + password-reset.php | 8 +-- profile.php | 4 +- 10 files changed, 153 insertions(+), 117 deletions(-) diff --git a/account.php b/account.php index 7ccb044..af3d3b0 100644 --- a/account.php +++ b/account.php @@ -3,11 +3,14 @@ use App\Account; use App\Diff; + use App\Make; $user_info = new Account(); $diff = new Diff(); + $make_stuff = new Make(); $profile_info = $user_info->get_user_info($conn, $_SESSION['id']); + $join_date = new DateTime($profile_info['created_at']); ?> @@ -29,63 +32,94 @@ } if ($user_info->is_loggedin($conn)) { - ?> -
-

Profile

-
-

Profile Picture

+ ?> +
"; + echo ""; + + $pfp_colour = $make_stuff->get_image_colour("usr/images/pfp/".$profile_info['pfp_path']); + if (empty($pfp_colour)) $pfp_colour = "var(--bg-3)"; + ?> + + "; + echo ""; } ?> -
- - -
+

+ is_admin($conn, $_SESSION['id'])) echo "Admin"; + ?> +

+
+

Member since: format('d/m/Y T'); ?>

-
- Go to profile +
+ +
+

Profile

+

Profile Picture

+
+ + +
+
@@ -517,9 +551,19 @@ $("#sanityCheck").html(response); thisButton.innerHTML = "Run check"; document.getElementById('sanityCheck').style.cssText = "transform: scale(1);opacity: 1;"; + }, + error: function(error) { + $("#sanityCheck").html(`

\ + Critical \ + An error occured when proccessing your request, sowwy :c\ +
\ + Response: ${error.status} - ${error.statusText}\ +

`); + thisButton.innerHTML = "Run check"; + document.getElementById('sanityCheck').style.cssText = "transform: scale(1);opacity: 1;"; } }); - }, 1000); + }, 621); }
diff --git a/app/account/account.php b/app/account/account.php index fb10677..a0b6e4f 100644 --- a/app/account/account.php +++ b/app/account/account.php @@ -499,16 +499,21 @@ if (isset($_POST['password_reset_submit'])) { if (mysqli_stmt_execute($stmt)) { // Password updated!!!! Now goodbye if ($user_id == $_SESSION["id"]) { + mysqli_query($conn,"INSERT INTO logs (ipaddress, action) VALUES('$user_ip','".$_SESSION['username']." has reset their password')"); + // Check if password reset was done by user session_destroy(); ?> get_user_info($conn, $user_id); + + mysqli_query($conn,"INSERT INTO logs (ipaddress, action) VALUES('$user_ip','".$_SESSION['username']." has reset ".$user_reset_info['username']." password')"); ?> diff --git a/password-reset.php b/password-reset.php index 824d073..9057a2a 100644 --- a/password-reset.php +++ b/password-reset.php @@ -26,8 +26,8 @@

After reset, you will be kicked out to login again


- -
+
@@ -40,13 +40,13 @@