feat: mail error sent

This commit is contained in:
2026-05-22 13:54:16 +02:00
parent 8ebfd6badf
commit 9fe51e8064
4 changed files with 37 additions and 1 deletions
+16 -1
View File
@@ -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;