mirror of
https://github.com/pixelfed/pixelfed.git
synced 2025-01-10 06:00:45 +00:00
Update ApiV1Dot1Controller, fix in-app registration
This commit is contained in:
parent
4e1dd59992
commit
56f17b9957
1 changed files with 2 additions and 5 deletions
|
@ -629,9 +629,6 @@ class ApiV1Dot1Controller extends Controller
|
||||||
abort_if(BouncerService::checkIp($request->ip()), 404);
|
abort_if(BouncerService::checkIp($request->ip()), 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$rl = RateLimiter::attempt('pf:apiv1.1:iarc:'.$request->ip(), config('pixelfed.app_registration_confirm_rate_limit_attempts', 20), function () {}, config('pixelfed.app_registration_confirm_rate_limit_decay', 1800));
|
|
||||||
abort_if(! $rl, 429, 'Too many requests');
|
|
||||||
|
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'user_token' => 'required',
|
'user_token' => 'required',
|
||||||
'random_token' => 'required',
|
'random_token' => 'required',
|
||||||
|
@ -658,7 +655,7 @@ class ApiV1Dot1Controller extends Controller
|
||||||
$user->last_active_at = now();
|
$user->last_active_at = now();
|
||||||
$user->save();
|
$user->save();
|
||||||
|
|
||||||
$token = $user->createToken('Pixelfed', ['read', 'write', 'follow', 'admin:read', 'admin:write', 'push']);
|
$token = $user->createToken('Pixelfed', ['read', 'write', 'follow', 'push']);
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'access_token' => $token->accessToken,
|
'access_token' => $token->accessToken,
|
||||||
|
@ -1292,7 +1289,7 @@ class ApiV1Dot1Controller extends Controller
|
||||||
if ($user->last_active_at == null) {
|
if ($user->last_active_at == null) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
$defaultCaption = "";
|
$defaultCaption = '';
|
||||||
$content = $request->filled('status') ? strip_tags(Purify::clean($request->input('status'))) : $defaultCaption;
|
$content = $request->filled('status') ? strip_tags(Purify::clean($request->input('status'))) : $defaultCaption;
|
||||||
$cw = $user->profile->cw == true ? true : $request->boolean('sensitive', false);
|
$cw = $user->profile->cw == true ? true : $request->boolean('sensitive', false);
|
||||||
$spoilerText = $cw && $request->filled('spoiler_text') ? $request->input('spoiler_text') : null;
|
$spoilerText = $cw && $request->filled('spoiler_text') ? $request->input('spoiler_text') : null;
|
||||||
|
|
Loading…
Reference in a new issue