toufikkhattara
Tapping into email verification functionality.
I see. I was confused at first since you did not mention that you extended the EmailVerificationController although it was somewhat obvious. I actually figured it out this way and implemented a new function toResponse inside the controller which I called from the route too. My case and implementation was slightly different and included the whole logic inside one function. Your solution was very insightful and not oddly specific 🙂
class CustomVerificationResponse extends EmailVerificationController
{
public function toResponse(Request $request): RedirectResponse
{
$user = User::find($request->route('id'));
if ($user->role === 'admin') {
return app(EmailVerificationResponse::class)->toResponse($request);
}
$user->markEmailAsVerified();
$token = Password::broker()->createToken($user);
$url = Filament::getResetPasswordUrl($token, $user);
return redirect()->to($url);
}
}
22 replies
Tapping into email verification functionality.
@Jon Mason Your solutions almost works for me but I am just confused as to how to bind the custom VerificationResponse to act instead of the default EmailVerificationResponse. I tried to register it inside my service providers but It does not work. I suspect that are some different mechanisms in Filament
22 replies