Update SettingsController

This commit is contained in:
Daniel Supernault 2018-12-20 23:18:06 -07:00
parent 868a83cb65
commit 251cb72aa4
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -15,6 +15,7 @@ use App\Http\Controllers\Settings\{
PrivacySettings, PrivacySettings,
SecuritySettings SecuritySettings
}; };
use App\Jobs\DeletePipeline\DeleteAccountPipeline;
class SettingsController extends Controller class SettingsController extends Controller
{ {
@ -43,7 +44,7 @@ class SettingsController extends Controller
'optimize_screen_reader', 'optimize_screen_reader',
'high_contrast_mode', 'high_contrast_mode',
'video_autoplay', 'video_autoplay',
]; ];
foreach ($fields as $field) { foreach ($fields as $field) {
$form = $request->input($field); $form = $request->input($field);
if ($form == 'on') { if ($form == 'on') {
@ -130,5 +131,26 @@ class SettingsController extends Controller
{ {
return view('settings.developers'); return view('settings.developers');
} }
public function removeAccountTemporary(Request $request)
{
return view('settings.remove.temporary');
}
public function removeAccountPermanent(Request $request)
{
return view('settings.remove.permanent');
}
public function removeAccountPermanentSubmit(Request $request)
{
$user = Auth::user();
if($user->is_admin == true) {
return abort(400, 'You cannot delete an admin account.');
}
DeleteAccountPipeline::dispatch($user);
Auth::logout();
return redirect('/');
}
} }