Phase 0: Fundament für Inhaus
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m14s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m12s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 1m7s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 1m19s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m32s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m22s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 1m32s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m35s
CI / Build-Artefakte aktuell (pull_request) Failing after 1m7s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m14s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m12s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 1m7s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 1m19s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m32s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m22s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 1m32s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m35s
CI / Build-Artefakte aktuell (pull_request) Failing after 1m7s
- Laravel 13 mit Filament 5 (Admin), Inertia 3 + Vue 3 + Vuetify 4 (Material 3) - Anmeldung über Fortify (Login, Passwort vergessen/ändern), keine Selbstregistrierung - Profil mit Profilbild (WebP in festen Größen), Personenseiten, Header mit Avatar-Menü - Material-3-Farbschema aus der Primärfarbe, hell/dunkel/System pro Person - Basis-Branding (Portalname, Logo, Primärfarbe) im Admin unter „Erscheinungsbild“ - Benutzerverwaltung im Admin, Zugang vorläufig über is_admin - vendor/ (ohne Dev-Pakete) und Frontend-Build mitversioniert, Dev-Pakete in vendor-dev/ - PHPUnit-Tests gegen MySQL/MariaDB, Forgejo-CI-Matrix, Docker-Entwicklungsumgebung - VERSION, CHANGELOG.md und CONTRIBUTING.md mit Release-Ablauf Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7197eaebf2
commit
9c0f8de791
15771 changed files with 1564103 additions and 5 deletions
74
vendor/laravel/passkeys/src/Http/Controllers/PasskeyConfirmationController.php
vendored
Normal file
74
vendor/laravel/passkeys/src/Http/Controllers/PasskeyConfirmationController.php
vendored
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Laravel\Passkeys\Http\Controllers;
|
||||
|
||||
use Illuminate\Auth\AuthenticationException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Session\Store as SessionStore;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Laravel\Passkeys\Actions\GenerateVerificationOptions;
|
||||
use Laravel\Passkeys\Actions\VerifyPasskey;
|
||||
use Laravel\Passkeys\Contracts\PasskeyConfirmationResponse;
|
||||
use Laravel\Passkeys\Contracts\PasskeyUser;
|
||||
use Laravel\Passkeys\Http\Requests\PasskeyVerificationRequest;
|
||||
use Laravel\Passkeys\Support\WebAuthn;
|
||||
use RuntimeException;
|
||||
|
||||
class PasskeyConfirmationController extends Controller
|
||||
{
|
||||
/**
|
||||
* Get passkey confirmation options for the authenticated user.
|
||||
*/
|
||||
public function index(Request $request, GenerateVerificationOptions $generate): JsonResponse
|
||||
{
|
||||
$user = Auth::guard(Config::string('passkeys.guard'))->user()
|
||||
?? throw new AuthenticationException;
|
||||
|
||||
if (! $user instanceof PasskeyUser) {
|
||||
throw new RuntimeException('User model must implement the PasskeyUser contract.');
|
||||
}
|
||||
|
||||
$options = $generate($user);
|
||||
|
||||
$serialized = WebAuthn::toJson($options);
|
||||
|
||||
$request->session()->put('passkey.verification_options', $serialized);
|
||||
|
||||
return response()->json([
|
||||
'options' => WebAuthn::toBrowserArray($options),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirm the user's password via passkey verification.
|
||||
*/
|
||||
public function store(
|
||||
PasskeyVerificationRequest $request,
|
||||
VerifyPasskey $verify,
|
||||
): PasskeyConfirmationResponse {
|
||||
$user = Auth::guard(Config::string('passkeys.guard'))->user()
|
||||
?? throw new AuthenticationException;
|
||||
|
||||
if (! $user instanceof PasskeyUser) {
|
||||
throw new RuntimeException('User model must implement the PasskeyUser contract.');
|
||||
}
|
||||
|
||||
$verify(
|
||||
$request->credential(),
|
||||
$request->verificationOptions(),
|
||||
$user
|
||||
);
|
||||
|
||||
/** @var SessionStore $session */
|
||||
$session = $request->session();
|
||||
|
||||
$session->passwordConfirmed();
|
||||
|
||||
return app(PasskeyConfirmationResponse::class);
|
||||
}
|
||||
}
|
||||
68
vendor/laravel/passkeys/src/Http/Controllers/PasskeyLoginController.php
vendored
Normal file
68
vendor/laravel/passkeys/src/Http/Controllers/PasskeyLoginController.php
vendored
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Laravel\Passkeys\Http\Controllers;
|
||||
|
||||
use Illuminate\Contracts\Auth\StatefulGuard;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Laravel\Passkeys\Actions\GenerateVerificationOptions;
|
||||
use Laravel\Passkeys\Actions\VerifyPasskey;
|
||||
use Laravel\Passkeys\Contracts\PasskeyLoginResponse;
|
||||
use Laravel\Passkeys\Exceptions\InvalidPasskeyException;
|
||||
use Laravel\Passkeys\Http\Requests\PasskeyVerificationRequest;
|
||||
use Laravel\Passkeys\Passkeys;
|
||||
use Laravel\Passkeys\Support\WebAuthn;
|
||||
use RuntimeException;
|
||||
|
||||
class PasskeyLoginController extends Controller
|
||||
{
|
||||
/**
|
||||
* Get passkey login options.
|
||||
*/
|
||||
public function index(Request $request, GenerateVerificationOptions $generate): JsonResponse
|
||||
{
|
||||
$options = $generate();
|
||||
|
||||
$serialized = WebAuthn::toJson($options);
|
||||
|
||||
$request->session()->put('passkey.verification_options', $serialized);
|
||||
|
||||
return response()->json([
|
||||
'options' => WebAuthn::toBrowserArray($options),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify the passkey and log the user in.
|
||||
*/
|
||||
public function store(
|
||||
PasskeyVerificationRequest $request,
|
||||
VerifyPasskey $verify,
|
||||
): PasskeyLoginResponse {
|
||||
$passkey = $verify(
|
||||
$request->credential(),
|
||||
$request->verificationOptions()
|
||||
);
|
||||
|
||||
$guard = Auth::guard(Config::string('passkeys.guard'));
|
||||
|
||||
if (! $guard instanceof StatefulGuard) {
|
||||
throw new RuntimeException('Passkeys requires a stateful authentication guard.');
|
||||
}
|
||||
|
||||
if (! Passkeys::allowsLogin($request, $passkey)) {
|
||||
throw InvalidPasskeyException::make('Unable to sign in with this account.');
|
||||
}
|
||||
|
||||
$guard->login($passkey->user, $request->remember());
|
||||
|
||||
$request->session()->regenerate();
|
||||
|
||||
return app(PasskeyLoginResponse::class);
|
||||
}
|
||||
}
|
||||
85
vendor/laravel/passkeys/src/Http/Controllers/PasskeyRegistrationController.php
vendored
Normal file
85
vendor/laravel/passkeys/src/Http/Controllers/PasskeyRegistrationController.php
vendored
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Laravel\Passkeys\Http\Controllers;
|
||||
|
||||
use Illuminate\Auth\AuthenticationException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Laravel\Passkeys\Actions\DeletePasskey;
|
||||
use Laravel\Passkeys\Actions\GenerateRegistrationOptions;
|
||||
use Laravel\Passkeys\Actions\StorePasskey;
|
||||
use Laravel\Passkeys\Contracts\PasskeyDeletedResponse;
|
||||
use Laravel\Passkeys\Contracts\PasskeyRegistrationResponse;
|
||||
use Laravel\Passkeys\Contracts\PasskeyUser;
|
||||
use Laravel\Passkeys\Http\Requests\PasskeyRegistrationRequest;
|
||||
use Laravel\Passkeys\Passkey;
|
||||
use Laravel\Passkeys\Support\WebAuthn;
|
||||
use RuntimeException;
|
||||
|
||||
class PasskeyRegistrationController extends Controller
|
||||
{
|
||||
/**
|
||||
* Get passkey registration options for the authenticated user.
|
||||
*/
|
||||
public function index(Request $request, GenerateRegistrationOptions $generate): JsonResponse
|
||||
{
|
||||
$user = Auth::guard(Config::string('passkeys.guard'))->user()
|
||||
?? throw new AuthenticationException;
|
||||
|
||||
$options = $generate($user);
|
||||
|
||||
$serialized = WebAuthn::toJson($options);
|
||||
|
||||
$request->session()->put('passkey.registration_options', $serialized);
|
||||
|
||||
return response()->json([
|
||||
'options' => WebAuthn::toBrowserArray($options),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a new passkey for the authenticated user.
|
||||
*/
|
||||
public function store(
|
||||
PasskeyRegistrationRequest $request,
|
||||
StorePasskey $storePasskey,
|
||||
): PasskeyRegistrationResponse {
|
||||
$user = Auth::guard(Config::string('passkeys.guard'))->user()
|
||||
?? throw new AuthenticationException;
|
||||
|
||||
$passkey = $storePasskey(
|
||||
$user,
|
||||
$request->string('name')->toString(),
|
||||
$request->credential(),
|
||||
$request->registrationOptions()
|
||||
);
|
||||
|
||||
return app(PasskeyRegistrationResponse::class)->withPasskey($passkey);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a passkey for the authenticated user.
|
||||
*/
|
||||
public function destroy(
|
||||
Passkey $passkey,
|
||||
DeletePasskey $deletePasskey
|
||||
): PasskeyDeletedResponse {
|
||||
$user = Auth::guard(Config::string('passkeys.guard'))->user()
|
||||
?? throw new AuthenticationException;
|
||||
|
||||
if (! $user instanceof PasskeyUser) {
|
||||
throw new RuntimeException('User model must implement the PasskeyUser contract.');
|
||||
}
|
||||
|
||||
abort_unless($passkey->user_id === $user->getKey(), 403);
|
||||
|
||||
$deletePasskey($user, $passkey);
|
||||
|
||||
return app(PasskeyDeletedResponse::class);
|
||||
}
|
||||
}
|
||||
89
vendor/laravel/passkeys/src/Http/Requests/PasskeyRegistrationRequest.php
vendored
Normal file
89
vendor/laravel/passkeys/src/Http/Requests/PasskeyRegistrationRequest.php
vendored
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Laravel\Passkeys\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Laravel\Passkeys\Support\WebAuthn;
|
||||
use Throwable;
|
||||
use Webauthn\PublicKeyCredential;
|
||||
use Webauthn\PublicKeyCredentialCreationOptions;
|
||||
|
||||
class PasskeyRegistrationRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* The deserialized public key credential.
|
||||
*/
|
||||
protected PublicKeyCredential $publicKeyCredential;
|
||||
|
||||
/**
|
||||
* 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, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'credential' => ['required', 'array'],
|
||||
'credential.id' => ['required', 'string'],
|
||||
'credential.rawId' => ['required', 'string'],
|
||||
'credential.type' => ['required', 'string', 'in:public-key'],
|
||||
'credential.response' => ['required', 'array'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a passed validation attempt.
|
||||
*/
|
||||
protected function passedValidation(): void
|
||||
{
|
||||
try {
|
||||
$this->publicKeyCredential = WebAuthn::fromJson(
|
||||
json_encode($this->input('credential')) ?: '{}',
|
||||
PublicKeyCredential::class
|
||||
);
|
||||
} catch (Throwable) {
|
||||
throw ValidationException::withMessages([
|
||||
'credential' => __('Invalid credential format.'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the public key credential.
|
||||
*/
|
||||
public function credential(): PublicKeyCredential
|
||||
{
|
||||
return $this->publicKeyCredential;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the registration options from the session.
|
||||
*
|
||||
* @throws ValidationException
|
||||
*/
|
||||
public function registrationOptions(): PublicKeyCredentialCreationOptions
|
||||
{
|
||||
/** @var string|null $serialized */
|
||||
$serialized = $this->session()->pull('passkey.registration_options');
|
||||
|
||||
if (! $serialized) {
|
||||
throw ValidationException::withMessages([
|
||||
'credential' => __('Passkey registration session expired. Please try again.'),
|
||||
]);
|
||||
}
|
||||
|
||||
return WebAuthn::fromJson($serialized, PublicKeyCredentialCreationOptions::class);
|
||||
}
|
||||
}
|
||||
97
vendor/laravel/passkeys/src/Http/Requests/PasskeyVerificationRequest.php
vendored
Normal file
97
vendor/laravel/passkeys/src/Http/Requests/PasskeyVerificationRequest.php
vendored
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Laravel\Passkeys\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Laravel\Passkeys\Support\WebAuthn;
|
||||
use Throwable;
|
||||
use Webauthn\PublicKeyCredential;
|
||||
use Webauthn\PublicKeyCredentialRequestOptions;
|
||||
|
||||
class PasskeyVerificationRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* The deserialized public key credential.
|
||||
*/
|
||||
protected PublicKeyCredential $publicKeyCredential;
|
||||
|
||||
/**
|
||||
* 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, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'credential' => ['required', 'array'],
|
||||
'credential.id' => ['required', 'string'],
|
||||
'credential.rawId' => ['required', 'string'],
|
||||
'credential.type' => ['required', 'string', 'in:public-key'],
|
||||
'credential.response' => ['required', 'array'],
|
||||
'remember' => ['boolean'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a passed validation attempt.
|
||||
*/
|
||||
protected function passedValidation(): void
|
||||
{
|
||||
try {
|
||||
$this->publicKeyCredential = WebAuthn::fromJson(
|
||||
json_encode($this->input('credential')) ?: '{}',
|
||||
PublicKeyCredential::class
|
||||
);
|
||||
} catch (Throwable) {
|
||||
throw ValidationException::withMessages([
|
||||
'credential' => __('Invalid credential format.'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the public key credential.
|
||||
*/
|
||||
public function credential(): PublicKeyCredential
|
||||
{
|
||||
return $this->publicKeyCredential;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the user wants to be remembered.
|
||||
*/
|
||||
public function remember(): bool
|
||||
{
|
||||
return $this->boolean('remember', false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the verification options from the session.
|
||||
*
|
||||
* @throws ValidationException
|
||||
*/
|
||||
public function verificationOptions(): PublicKeyCredentialRequestOptions
|
||||
{
|
||||
/** @var string|null $serialized */
|
||||
$serialized = $this->session()->pull('passkey.verification_options');
|
||||
|
||||
if (! $serialized) {
|
||||
throw ValidationException::withMessages([
|
||||
'credential' => __('Passkey verification session expired. Please try again.'),
|
||||
]);
|
||||
}
|
||||
|
||||
return WebAuthn::fromJson($serialized, PublicKeyCredentialRequestOptions::class);
|
||||
}
|
||||
}
|
||||
30
vendor/laravel/passkeys/src/Http/Responses/PasskeyConfirmationResponse.php
vendored
Normal file
30
vendor/laravel/passkeys/src/Http/Responses/PasskeyConfirmationResponse.php
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Laravel\Passkeys\Http\Responses;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Laravel\Passkeys\Contracts\PasskeyConfirmationResponse as PasskeyConfirmationResponseContract;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class PasskeyConfirmationResponse implements PasskeyConfirmationResponseContract
|
||||
{
|
||||
/**
|
||||
* Create an HTTP response that represents the object.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
*/
|
||||
public function toResponse($request)
|
||||
{
|
||||
if ($request->wantsJson()) {
|
||||
return new JsonResponse([
|
||||
'redirect' => redirect()->intended()->getTargetUrl(),
|
||||
], 200);
|
||||
}
|
||||
|
||||
return redirect()->intended();
|
||||
}
|
||||
}
|
||||
28
vendor/laravel/passkeys/src/Http/Responses/PasskeyDeletedResponse.php
vendored
Normal file
28
vendor/laravel/passkeys/src/Http/Responses/PasskeyDeletedResponse.php
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Laravel\Passkeys\Http\Responses;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Laravel\Passkeys\Contracts\PasskeyDeletedResponse as PasskeyDeletedResponseContract;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class PasskeyDeletedResponse implements PasskeyDeletedResponseContract
|
||||
{
|
||||
/**
|
||||
* Create an HTTP response that represents the object.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
*/
|
||||
public function toResponse($request)
|
||||
{
|
||||
if ($request->wantsJson()) {
|
||||
return new JsonResponse(['status' => 'passkey-deleted'], 200);
|
||||
}
|
||||
|
||||
return back()->with('status', 'passkey-deleted');
|
||||
}
|
||||
}
|
||||
30
vendor/laravel/passkeys/src/Http/Responses/PasskeyLoginResponse.php
vendored
Normal file
30
vendor/laravel/passkeys/src/Http/Responses/PasskeyLoginResponse.php
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Laravel\Passkeys\Http\Responses;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Laravel\Passkeys\Contracts\PasskeyLoginResponse as PasskeyLoginResponseContract;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class PasskeyLoginResponse implements PasskeyLoginResponseContract
|
||||
{
|
||||
/**
|
||||
* Create an HTTP response that represents the object.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
*/
|
||||
public function toResponse($request)
|
||||
{
|
||||
if ($request->wantsJson()) {
|
||||
return new JsonResponse([
|
||||
'redirect' => redirect()->intended(config('passkeys.redirect', '/'))->getTargetUrl(),
|
||||
], 200);
|
||||
}
|
||||
|
||||
return redirect()->intended(config('passkeys.redirect', '/'));
|
||||
}
|
||||
}
|
||||
51
vendor/laravel/passkeys/src/Http/Responses/PasskeyRegistrationResponse.php
vendored
Normal file
51
vendor/laravel/passkeys/src/Http/Responses/PasskeyRegistrationResponse.php
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Laravel\Passkeys\Http\Responses;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Laravel\Passkeys\Contracts\PasskeyRegistrationResponse as PasskeyRegistrationResponseContract;
|
||||
use Laravel\Passkeys\Passkey;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class PasskeyRegistrationResponse implements PasskeyRegistrationResponseContract
|
||||
{
|
||||
/**
|
||||
* The passkey that was registered.
|
||||
*/
|
||||
protected ?Passkey $passkey = null;
|
||||
|
||||
/**
|
||||
* Set the passkey that was registered.
|
||||
*/
|
||||
public function withPasskey(Passkey $passkey): static
|
||||
{
|
||||
$this->passkey = $passkey;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an HTTP response that represents the object.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
*/
|
||||
public function toResponse($request)
|
||||
{
|
||||
if (! $request->wantsJson()) {
|
||||
return back()->with('status', 'passkey-registered');
|
||||
}
|
||||
|
||||
$data = ['status' => 'passkey-registered'];
|
||||
|
||||
if ($this->passkey instanceof Passkey) {
|
||||
$data['id'] = (string) $this->passkey->id;
|
||||
$data['name'] = $this->passkey->name;
|
||||
}
|
||||
|
||||
return new JsonResponse($data, 200);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue