1
0
Fork 0
forked from mirror/pixelfed

Update SettingsController

This commit is contained in:
Daniel Supernault 2019-07-11 21:04:47 -06:00
parent bcfbb0299c
commit 20caabc358
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -10,6 +10,7 @@ use App\UserFilter;
use Auth, Cookie, DB, Cache, Purify; use Auth, Cookie, DB, Cache, Purify;
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Str;
use App\Http\Controllers\Settings\{ use App\Http\Controllers\Settings\{
ExportSettings, ExportSettings,
LabsSettings, LabsSettings,
@ -188,12 +189,12 @@ class SettingsController extends Controller
'opencollective' => 'nullable|string' 'opencollective' => 'nullable|string'
]); ]);
$patreon = $request->input('patreon'); $patreon = Str::startsWith($request->input('patreon'), 'patreon.com/') ? e($request->input('patreon')) : null;
$liberapay = $request->input('liberapay'); $liberapay = Str::startsWith($request->input('liberapay'), 'liberapay.com/') ? e($request->input('liberapay')) : null;
$opencollective = $request->input('opencollective'); $opencollective = Str::startsWith($request->input('opencollective'), 'opencollective.com/') ? e($request->input('opencollective')) : null;
if(empty($patreon) && empty($liberapay) && empty($opencollective)) { if(empty($patreon) && empty($liberapay) && empty($opencollective)) {
abort(400, 'Bad request'); return redirect(route('settings'))->with('error', 'An error occured. Please try again later.');;
} }
$res = [ $res = [
@ -210,5 +211,6 @@ class SettingsController extends Controller
$sponsors = $res; $sponsors = $res;
return redirect(route('settings'))->with('status', 'Sponsor settings successfully updated!');; return redirect(route('settings'))->with('status', 'Sponsor settings successfully updated!');;
} }
} }