laravel / jetstream

Tailwind scaffolding for the Laravel framework.
https://jetstream.laravel.com
MIT License
3.95k stars 809 forks source link

User Verification Using Notification Channels #626

Closed dillingham closed 3 years ago

dillingham commented 3 years ago

Would be pretty awesome if we could use a notification channel for verification. Email (current) is default. But also sms, phone, etc. Even address verification with a postcard (like nextdoor app) using lob notification channel Maybe even use same programming for 2FA with sms, email & phone codes like banks etc

joelbutcher commented 3 years ago

Whilst this would be cool, this isn't the responsibility of Jetstream. Laravel's user verification by default only uses the users email.

Take a look at the App\Actions\Fortify\CreateNewUser action - this is where the logic is called for sending the verification email. If you want this specific functionality, your best to implement this in your own application, like everyone else.

Alternatively, you could build a package that replaces the action.

dillingham commented 3 years ago

It does seem more of an Illuminate topic. Just removing the word email from this class illustrates my pointt. But I see what you mean.

<?php

namespace Illuminate\Auth\Listeners;

use Illuminate\Auth\Events\Registered;
use Illuminate\Contracts\Auth\MustVerifyEmail;

class SendVerificationNotification
{
    /**
     * Handle the event.
     *
     * @param  \Illuminate\Auth\Events\Registered  $event
     * @return void
     */
    public function handle(Registered $event)
    {
        if ($event->user instanceof MustVerify && ! $event->user->isVerified()) {
            $event->user->sendVerificationNotification();
        }
    }
}
driesvints commented 3 years ago

We have no plans for this atm sorry. Feel free to build this into your own app.