mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-06 13:10:37 -04:00
Enable Fortify passkeys (laravel/passkeys) with the @laravel/passkeys client. Users can sign in with a passkey, confirm sensitive actions with one, and add, rename, and delete passkeys on the Profile page. - Resolve the relying party for each request from the instance URL, then APP_URL, then localhost. Passkey routes return 404 on other hosts. - Add the is_passkey_enabled instance setting (Settings > Advanced). - Use a hex user handle (laravel/passkeys-server#41). - Rate limit the passkey routes by client IP. - Record audit events for registered, verified, and deleted passkeys.
23 lines
653 B
JavaScript
23 lines
653 B
JavaScript
import { Passkeys } from '@laravel/passkeys';
|
|
|
|
window.Passkeys = Passkeys;
|
|
|
|
window.passkeyDeviceName = () => {
|
|
const ua = navigator.userAgent;
|
|
const browser = /Edg\//.test(ua) ? 'Edge'
|
|
: /Firefox\//.test(ua) ? 'Firefox'
|
|
: /Chrome\//.test(ua) ? 'Chrome'
|
|
: /Safari\//.test(ua) ? 'Safari'
|
|
: 'Browser';
|
|
const os = /iPhone|iPad/.test(ua) ? 'iOS'
|
|
: /Android/.test(ua) ? 'Android'
|
|
: /Mac/.test(ua) ? 'Mac'
|
|
: /Windows/.test(ua) ? 'Windows'
|
|
: /Linux/.test(ua) ? 'Linux'
|
|
: 'device';
|
|
|
|
return `${browser} on ${os}`;
|
|
};
|
|
|
|
window.dispatchEvent(new CustomEvent('passkeys:ready'));
|