feat: mail error sent
This commit is contained in:
@@ -24,6 +24,7 @@ use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\ValidatedInput;
|
||||
use Illuminate\View\View;
|
||||
use Throwable;
|
||||
|
||||
class AuthController extends Controller
|
||||
{
|
||||
@@ -43,7 +44,21 @@ class AuthController extends Controller
|
||||
|
||||
$user = User::create($userAttributes);
|
||||
|
||||
$user->sendEmailVerificationNotification();
|
||||
try {
|
||||
$user->sendEmailVerificationNotification();
|
||||
} catch (Throwable $exception) {
|
||||
report($exception);
|
||||
|
||||
$user->forceDelete();
|
||||
|
||||
if ($avatarPath !== null) {
|
||||
Storage::disk('public')->delete($avatarPath);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'message' => __('api.auth.verification_email_failed'),
|
||||
], 503);
|
||||
}
|
||||
|
||||
$token = $user->createToken('api', ['user'])->plainTextToken;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user