lang bugfix
All checks were successful
Build & Push Docker Image / docker (push) Successful in 1m48s

This commit is contained in:
Ahmed Darrazi 2025-12-18 20:59:36 +01:00
parent 7b5bd97215
commit 4aa98c1921
3 changed files with 22 additions and 12 deletions

View File

@ -9,6 +9,7 @@ use Illuminate\Auth\Events\Verified;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Password;
class VerifyEmailController extends Controller class VerifyEmailController extends Controller
{ {
@ -32,6 +33,15 @@ class VerifyEmailController extends Controller
event(new Verified($user)); 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()) { if (Auth::check()) {
$redirect = Auth::user()->role === UserType::STUDENT->value $redirect = Auth::user()->role === UserType::STUDENT->value
? route('student.index', ['tab' => 'courses'], absolute: false) ? route('student.index', ['tab' => 'courses'], absolute: false)

View File

@ -13,13 +13,7 @@ class VerifyEmailNotification extends Notification
{ {
use Queueable; use Queueable;
/** public function __construct(protected bool $invite = false) {}
* Create a new notification instance.
*/
public function __construct()
{
//
}
/** /**
* Get the notification's delivery channels. * Get the notification's delivery channels.
@ -39,13 +33,19 @@ class VerifyEmailNotification extends Notification
*/ */
protected function verificationUrl($notifiable) protected function verificationUrl($notifiable)
{ {
$params = [
'id' => $notifiable->getKey(),
'hash' => sha1($notifiable->getEmailForVerification()),
];
if ($this->invite) {
$params['invite'] = 1;
}
return URL::temporarySignedRoute( return URL::temporarySignedRoute(
'verification.verify', 'verification.verify',
now()->addMinutes(config('auth.verification.expire', 5)), now()->addMinutes(config('auth.verification.expire', 5)),
[ $params
'id' => $notifiable->getKey(),
'hash' => sha1($notifiable->getEmailForVerification()),
]
); );
} }

View File

@ -51,7 +51,7 @@ class UserService
]); ]);
DB::afterCommit(function () use ($user) { DB::afterCommit(function () use ($user) {
$user->notify(new VerifyEmailNotification()); $user->notify(new VerifyEmailNotification(true));
}); });
return $user; return $user;