mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-10 00:34:50 +00:00
Update SettingsController
This commit is contained in:
parent
9524ea19f5
commit
cd9db4fe0c
1 changed files with 14 additions and 6 deletions
|
@ -92,12 +92,20 @@ class SettingsController extends Controller
|
||||||
|
|
||||||
public function removeAccountTemporary(Request $request)
|
public function removeAccountTemporary(Request $request)
|
||||||
{
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
abort_if(!config('pixelfed.account_deletion'), 403);
|
||||||
|
abort_if($user->is_admin, 403);
|
||||||
|
abort_if($user->created_at->gt(now()->subHours(12)), 403);
|
||||||
|
|
||||||
return view('settings.remove.temporary');
|
return view('settings.remove.temporary');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removeAccountTemporarySubmit(Request $request)
|
public function removeAccountTemporarySubmit(Request $request)
|
||||||
{
|
{
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
|
abort_if(!config('pixelfed.account_deletion'), 403);
|
||||||
|
abort_if($user->is_admin, 403);
|
||||||
|
abort_if($user->created_at->gt(now()->subHours(12)), 403);
|
||||||
$profile = $user->profile;
|
$profile = $user->profile;
|
||||||
$user->status = 'disabled';
|
$user->status = 'disabled';
|
||||||
$profile->status = 'disabled';
|
$profile->status = 'disabled';
|
||||||
|
@ -110,9 +118,9 @@ class SettingsController extends Controller
|
||||||
|
|
||||||
public function removeAccountPermanent(Request $request)
|
public function removeAccountPermanent(Request $request)
|
||||||
{
|
{
|
||||||
if(config('pixelfed.account_deletion') == false) {
|
$user = Auth::user();
|
||||||
abort(404);
|
abort_if($user->is_admin, 403);
|
||||||
}
|
abort_if($user->created_at->gt(now()->subDays(7)), 403);
|
||||||
return view('settings.remove.permanent');
|
return view('settings.remove.permanent');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,9 +130,9 @@ class SettingsController extends Controller
|
||||||
abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
if($user->is_admin == true) {
|
abort_if(!config('pixelfed.account_deletion'), 403);
|
||||||
return abort(400, 'You cannot delete an admin account.');
|
abort_if($user->is_admin, 403);
|
||||||
}
|
abort_if($user->created_at->gt(now()->subDays(7)), 403);
|
||||||
$profile = $user->profile;
|
$profile = $user->profile;
|
||||||
$ts = Carbon::now()->addMonth();
|
$ts = Carbon::now()->addMonth();
|
||||||
$user->status = 'delete';
|
$user->status = 'delete';
|
||||||
|
|
Loading…
Reference in a new issue