Files
InvoiceShelf/resources/views/emails/company-invitation.blade.php
Darko Gjorgjijoski c1994887ef Support invitations for unregistered users
When inviting an email without an InvoiceShelf account, the email now
links to a registration page (/register?invitation={token}) instead of
login. After registering, the invitation is auto-accepted.

Backend:
- InvitationRegistrationController: public details() and register()
  endpoints. Registration validates token + email match, creates account,
  auto-accepts invitation, returns Sanctum token.
- AuthController: login now accepts optional invitation_token param to
  auto-accept invitation for existing users clicking the email link.
- CompanyInvitationMail: conditional URL based on user existence.
- Web route for /invitations/{token}/decline (email decline link).

Frontend:
- RegisterWithInvitation.vue: fetches invitation details, shows company
  name + role, registration form with pre-filled email.
- Router: /register route added.

Tests: 3 new tests (invitation details, register + accept, email mismatch).
2026-04-03 23:26:58 +02:00

23 lines
546 B
PHP

<x-mail::message>
# You've been invited!
**{{ $inviterName }}** has invited you to join **{{ $companyName }}** as **{{ $roleName }}**.
@if($hasAccount)
Log in to accept the invitation:
@else
Create your account to get started:
@endif
<x-mail::button :url="$acceptUrl">
{{ $hasAccount ? 'Log In & Accept' : 'Create Account & Accept' }}
</x-mail::button>
If you don't want to join, you can <a href="{{ $declineUrl }}">decline this invitation</a>.
This invitation will expire in 7 days.
Thanks,<br>
{{ config('app.name') }}
</x-mail::message>