feat: google login
CI / 🧪 Tests Laravel (push) Failing after 9s
CI / 🐳 Build & Push Images (push) Has been skipped

This commit is contained in:
2026-08-17 10:06:35 +02:00
parent c0688044e8
commit ddc80956a0
22 changed files with 1886 additions and 6 deletions
@@ -0,0 +1,62 @@
<?php
namespace App\Http\Requests;
use App\Enums\SocialProvider;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class MobileSocialLoginRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'authorizationCode' => [
'nullable',
Rule::requiredIf($this->input('provider') === SocialProvider::Apple->value),
'string',
'max:4096',
],
'deviceName' => ['sometimes', 'string', 'max:255'],
'device_name' => ['sometimes', 'string', 'max:255'],
'idToken' => ['required', 'string', 'max:10000'],
'intent' => ['required', Rule::in(['login', 'register'])],
'locale' => ['sometimes', 'string', Rule::in(config('app.supported_locales', ['fr', 'en']))],
'name' => ['sometimes', 'nullable', 'string', 'max:255'],
'nonce' => ['required', 'string', 'size:64', 'regex:/\A[a-f0-9]{64}\z/'],
'provider' => ['required', Rule::enum(SocialProvider::class)],
'termsAccepted' => ['required', 'boolean'],
];
}
protected function prepareForValidation(): void
{
if ($this->has('locale')) {
$locale = strtolower(str_replace('_', '-', (string) $this->input('locale')));
$this->merge([
'locale' => explode('-', $locale)[0],
]);
}
if ($this->has('deviceName') && ! $this->has('device_name')) {
$this->merge([
'device_name' => $this->input('deviceName'),
]);
}
}
}