Add check for users when deleting profile so they do not delete another users profile

This commit is contained in:
DariusIII
2018-02-01 10:01:33 +01:00
parent f3a536600b
commit d03a705fd0
5 changed files with 24 additions and 4 deletions
+1
View File
@@ -1,4 +1,5 @@
2018-02-01 DariusIII
* Chg: Add check for users when deleting profile so they do not delete another users profile
* Chg: Remove occurences of ROLE_GUEST as that role is removed
2018-01-31 DariusIII
* Chg: Add option to users to delete their account from profile page
+8
View File
@@ -277,6 +277,14 @@ class BasePage
die(view('errors.503'));
}
/**
* Show 503 page.
*/
public function showBadBoy(): void
{
die(view('errors.badboy'));
}
/**
* Show maintenance page.
*/
+3 -1
View File
@@ -8,8 +8,10 @@ if (! User::isLoggedIn()) {
$userId = $_GET['id'];
if ($userId !== null) {
if ($userId !== null && (int) $userId === User::currentUserId()) {
User::logout();
User::deleteUser($userId);
header('Location: '.WWW_TOP.'/');
} else {
$page->showBadBoy();
}
+11
View File
@@ -0,0 +1,11 @@
@extends('errors.layout')
@section('title')
You bad boy!
@endsection
@section('content')
You tried to delete another users account!
@endsection
+1 -3
View File
@@ -41,9 +41,7 @@
</head>
<body>
<div class="container">
<div>
@yield('content')
</div>
@yield('content')
</div>
</body>
</html>