putraprima
putraprima
FFilament
Created by mrvn on 5/20/2024 in #❓┊help
Customize VerifyEmail template and other login related emails
Here is some code snippet panel provider
return $panel
->default()
->id('user')
->path('user')
->login()
->registration(Register::class)
->emailVerification(EmailVerificationPrompt::class)
->passwordReset(RequestPasswordReset::class)
->sidebarWidth('16rem')
->colors([
'primary' => Color::Indigo,
])
return $panel
->default()
->id('user')
->path('user')
->login()
->registration(Register::class)
->emailVerification(EmailVerificationPrompt::class)
->passwordReset(RequestPasswordReset::class)
->sidebarWidth('16rem')
->colors([
'primary' => Color::Indigo,
])
Custom register page
<?php

namespace App\Filament\User\Pages\Auth;

use Filament\Pages\Auth\Register as AuthRegister;
use App\Notifications\VerifyEmailNotification;
use Exception;
use Filament\Facades\Filament;
use Filament\Pages\Auth\EmailVerification\EmailVerificationPrompt as BaseEmailVerificationPrompt;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Model;

class Register extends AuthRegister
{
protected function sendEmailVerificationNotification(Model $user): void
{
if (!$user instanceof MustVerifyEmail) {
return;
}

if ($user->hasVerifiedEmail()) {
return;
}

if (!method_exists($user, 'notify')) {
$userClass = $user::class;

throw new Exception("Model [{$userClass}] does not have a [notify()] method.");
}

$notification = new VerifyEmailNotification(Filament::getVerifyEmailUrl($user));

$user->notify($notification);
}
}
<?php

namespace App\Filament\User\Pages\Auth;

use Filament\Pages\Auth\Register as AuthRegister;
use App\Notifications\VerifyEmailNotification;
use Exception;
use Filament\Facades\Filament;
use Filament\Pages\Auth\EmailVerification\EmailVerificationPrompt as BaseEmailVerificationPrompt;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Model;

class Register extends AuthRegister
{
protected function sendEmailVerificationNotification(Model $user): void
{
if (!$user instanceof MustVerifyEmail) {
return;
}

if ($user->hasVerifiedEmail()) {
return;
}

if (!method_exists($user, 'notify')) {
$userClass = $user::class;

throw new Exception("Model [{$userClass}] does not have a [notify()] method.");
}

$notification = new VerifyEmailNotification(Filament::getVerifyEmailUrl($user));

$user->notify($notification);
}
}
10 replies
FFilament
Created by mrvn on 5/20/2024 in #❓┊help
Customize VerifyEmail template and other login related emails
Oooh nevermind guys i got it : 1. Povilas tutorial is correct it works perfectly 2. To implement custom email message on registration you should also Extend the registration page in filament vendor 3. Create custom message for the first email when user register 4. Also create custom page for email verification prompt with custom email message so the user
10 replies
FFilament
Created by mrvn on 5/20/2024 in #❓┊help
Customize VerifyEmail template and other login related emails
But i can confirm that the custom reset password email message works perfectly
10 replies
FFilament
Created by mrvn on 5/20/2024 in #❓┊help
Customize VerifyEmail template and other login related emails
any hints of how to fix it ?
10 replies
FFilament
Created by mrvn on 5/20/2024 in #❓┊help
Customize VerifyEmail template and other login related emails
i tried this logic but the first email send by filament always the default one but if we click the send email again button it will send the customized template
10 replies