mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-30 02:03:16 +00:00
Update SettingsController
This commit is contained in:
parent
95301f1357
commit
44cac7c1df
1 changed files with 22 additions and 5 deletions
|
@ -5,10 +5,8 @@ namespace App\Http\Controllers;
|
||||||
use App\AccountLog;
|
use App\AccountLog;
|
||||||
use App\Following;
|
use App\Following;
|
||||||
use App\UserFilter;
|
use App\UserFilter;
|
||||||
use Auth;
|
use Auth, DB, Cache, Purify;
|
||||||
use DB;
|
use Carbon\Carbon;
|
||||||
use Cache;
|
|
||||||
use Purify;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Http\Controllers\Settings\{
|
use App\Http\Controllers\Settings\{
|
||||||
HomeSettings,
|
HomeSettings,
|
||||||
|
@ -137,6 +135,18 @@ class SettingsController extends Controller
|
||||||
return view('settings.remove.temporary');
|
return view('settings.remove.temporary');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function removeAccountTemporarySubmit(Request $request)
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
$profile = $user->profile;
|
||||||
|
$user->status = 'disabled';
|
||||||
|
$profile->status = 'disabled';
|
||||||
|
$user->save();
|
||||||
|
$profile->save();
|
||||||
|
Auth::logout();
|
||||||
|
return redirect('/');
|
||||||
|
}
|
||||||
|
|
||||||
public function removeAccountPermanent(Request $request)
|
public function removeAccountPermanent(Request $request)
|
||||||
{
|
{
|
||||||
return view('settings.remove.permanent');
|
return view('settings.remove.permanent');
|
||||||
|
@ -148,7 +158,14 @@ class SettingsController extends Controller
|
||||||
if($user->is_admin == true) {
|
if($user->is_admin == true) {
|
||||||
return abort(400, 'You cannot delete an admin account.');
|
return abort(400, 'You cannot delete an admin account.');
|
||||||
}
|
}
|
||||||
DeleteAccountPipeline::dispatch($user);
|
$profile = $user->profile;
|
||||||
|
$ts = Carbon::now()->addMonth();
|
||||||
|
$user->status = 'delete';
|
||||||
|
$profile->status = 'delete';
|
||||||
|
$user->delete_after = $ts;
|
||||||
|
$profile->delete_after = $ts;
|
||||||
|
$user->save();
|
||||||
|
$profile->save();
|
||||||
Auth::logout();
|
Auth::logout();
|
||||||
return redirect('/');
|
return redirect('/');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue