From 4aa98c19212530c001a48431d49345441729d3a1 Mon Sep 17 00:00:00 2001 From: Ahmed Darrazi Date: Thu, 18 Dec 2025 20:59:36 +0100 Subject: [PATCH] lang bugfix --- .../Auth/VerifyEmailController.php | 10 +++++++++ app/Notifications/VerifyEmailNotification.php | 22 +++++++++---------- app/Services/UserService.php | 2 +- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/app/Http/Controllers/Auth/VerifyEmailController.php b/app/Http/Controllers/Auth/VerifyEmailController.php index 360ab140..24314471 100644 --- a/app/Http/Controllers/Auth/VerifyEmailController.php +++ b/app/Http/Controllers/Auth/VerifyEmailController.php @@ -9,6 +9,7 @@ use Illuminate\Auth\Events\Verified; use Illuminate\Http\Request; use Illuminate\Http\RedirectResponse; use Illuminate\Support\Facades\Auth; +use Illuminate\Support\Facades\Password; class VerifyEmailController extends Controller { @@ -32,6 +33,15 @@ class VerifyEmailController extends Controller event(new Verified($user)); } + if ($request->boolean('invite')) { + $token = Password::createToken($user); + + return redirect()->route('password.reset', [ + 'token' => $token, + 'email' => $user->email, + ], absolute: false); + } + if (Auth::check()) { $redirect = Auth::user()->role === UserType::STUDENT->value ? route('student.index', ['tab' => 'courses'], absolute: false) diff --git a/app/Notifications/VerifyEmailNotification.php b/app/Notifications/VerifyEmailNotification.php index 8f627fa3..7de0cecc 100644 --- a/app/Notifications/VerifyEmailNotification.php +++ b/app/Notifications/VerifyEmailNotification.php @@ -13,13 +13,7 @@ class VerifyEmailNotification extends Notification { use Queueable; - /** - * Create a new notification instance. - */ - public function __construct() - { - // - } + public function __construct(protected bool $invite = false) {} /** * Get the notification's delivery channels. @@ -39,13 +33,19 @@ class VerifyEmailNotification extends Notification */ protected function verificationUrl($notifiable) { + $params = [ + 'id' => $notifiable->getKey(), + 'hash' => sha1($notifiable->getEmailForVerification()), + ]; + + if ($this->invite) { + $params['invite'] = 1; + } + return URL::temporarySignedRoute( 'verification.verify', now()->addMinutes(config('auth.verification.expire', 5)), - [ - 'id' => $notifiable->getKey(), - 'hash' => sha1($notifiable->getEmailForVerification()), - ] + $params ); } diff --git a/app/Services/UserService.php b/app/Services/UserService.php index a64e7be5..bc832bc0 100644 --- a/app/Services/UserService.php +++ b/app/Services/UserService.php @@ -51,7 +51,7 @@ class UserService ]); DB::afterCommit(function () use ($user) { - $user->notify(new VerifyEmailNotification()); + $user->notify(new VerifyEmailNotification(true)); }); return $user;