From ca934e7cdf20671534cbe6f1fb7dfdb4e76a5f75 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 31 May 2024 11:03:43 +0200 Subject: [PATCH] fix: allow invitations via email --- app/Livewire/Team/InviteLink.php | 5 ++++ .../views/livewire/team/invite-link.blade.php | 26 +++++++++++-------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/app/Livewire/Team/InviteLink.php b/app/Livewire/Team/InviteLink.php index cc9054888..c03bb0c45 100644 --- a/app/Livewire/Team/InviteLink.php +++ b/app/Livewire/Team/InviteLink.php @@ -17,6 +17,10 @@ class InviteLink extends Component public string $email; public string $role = 'member'; + protected $rules = [ + 'email' => 'required|email', + 'role' => 'required|string', + ]; public function mount() { $this->email = isDev() ? 'test3@example.com' : ''; @@ -34,6 +38,7 @@ public function viaLink() private function generate_invite_link(bool $sendEmail = false) { try { + $this->validate(); $member_emails = currentTeam()->members()->get()->pluck('email'); if ($member_emails->contains($this->email)) { return handleError(livewire: $this, customErrorMessage: "$this->email is already a member of " . currentTeam()->name . "."); diff --git a/resources/views/livewire/team/invite-link.blade.php b/resources/views/livewire/team/invite-link.blade.php index 3352ae28d..8ad0b4761 100644 --- a/resources/views/livewire/team/invite-link.blade.php +++ b/resources/views/livewire/team/invite-link.blade.php @@ -1,14 +1,18 @@
-
- - - - - - - Generate Invitation Link - @if (is_transactional_emails_active()) - Send Invitation Email - @endif + +
+ + + + + + +
+
+ Generate Invitation Link + @if (is_transactional_emails_active()) + Send Invitation via Email + @endif +