mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-10 00:34:50 +00:00
commit
0fd4481ca6
2 changed files with 17 additions and 7 deletions
|
@ -92,12 +92,20 @@ class SettingsController extends Controller
|
|||
|
||||
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');
|
||||
}
|
||||
|
||||
public function removeAccountTemporarySubmit(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);
|
||||
$profile = $user->profile;
|
||||
$user->status = 'disabled';
|
||||
$profile->status = 'disabled';
|
||||
|
@ -110,9 +118,9 @@ class SettingsController extends Controller
|
|||
|
||||
public function removeAccountPermanent(Request $request)
|
||||
{
|
||||
if(config('pixelfed.account_deletion') == false) {
|
||||
abort(404);
|
||||
}
|
||||
$user = Auth::user();
|
||||
abort_if($user->is_admin, 403);
|
||||
abort_if($user->created_at->gt(now()->subDays(7)), 403);
|
||||
return view('settings.remove.permanent');
|
||||
}
|
||||
|
||||
|
@ -122,9 +130,9 @@ class SettingsController extends Controller
|
|||
abort(404);
|
||||
}
|
||||
$user = Auth::user();
|
||||
if($user->is_admin == true) {
|
||||
return abort(400, 'You cannot delete an admin account.');
|
||||
}
|
||||
abort_if(!config('pixelfed.account_deletion'), 403);
|
||||
abort_if($user->is_admin, 403);
|
||||
abort_if($user->created_at->gt(now()->subDays(7)), 403);
|
||||
$profile = $user->profile;
|
||||
$ts = Carbon::now()->addMonth();
|
||||
$user->status = 'delete';
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
@include('settings.security.device-panel')
|
||||
|
||||
@if(config('pixelfed.account_deletion') == true)
|
||||
@if(config('pixelfed.account_deletion') && !$user->is_admin && $user->created_at->gt(now()->subHours(12)))
|
||||
<h4 class="font-weight-bold pt-3">Danger Zone</h4>
|
||||
<div class="mb-4 border rounded border-danger">
|
||||
<ul class="list-group mb-0 pb-0">
|
||||
|
@ -40,6 +40,7 @@
|
|||
<a class="btn btn-outline-danger font-weight-bold py-1" href="{{route('settings.remove.temporary')}}">Disable</a>
|
||||
</div>
|
||||
</li>
|
||||
@if( !$user->is_admin && $user->created_at->gt(now()->subDays(7)) )
|
||||
<li class="list-group-item border-left-0 border-right-0 py-3 d-flex justify-content-between">
|
||||
<div>
|
||||
<p class="font-weight-bold mb-1">Delete this Account</p>
|
||||
|
@ -49,6 +50,7 @@
|
|||
<a class="btn btn-outline-danger font-weight-bold py-1" href="{{route('settings.remove.permanent')}}">Delete</a>
|
||||
</div>
|
||||
</li>
|
||||
@endif
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
|
|
Loading…
Reference in a new issue