Fix Signed url to be relative a cause de serveurs de merde

This commit is contained in:
Jérémy Munsch 2023-03-24 19:15:15 +01:00
parent 2b1a47f48c
commit f90e808cd0
No known key found for this signature in database
GPG key ID: 18361AF3BFEC0FEC
4 changed files with 67 additions and 2 deletions

View file

@ -18,7 +18,7 @@ class VerificationController extends Controller
public function __construct()
{
$this->middleware('auth:frontend');
$this->middleware('signed')->only('verify');
$this->middleware('signed:relative')->only('verify');
$this->middleware('throttle:6,1')->only('verify', 'resend');
}

View file

@ -56,7 +56,12 @@ abstract class PaymentAdapter
protected function successRoute(Transaction $transaction, array $parameters = []): string
{
$parameters['transaction'] = $transaction;
return URL::signedRoute('order-tunnel.checkout', $parameters, \now()->addMinutes(3));
return \url(URL::temporarySignedRoute(
'verification.verify',
\now()->addMinutes(3),
$parameters,
false
));
}
/**

View file

@ -4,9 +4,39 @@ namespace App\Notifications\Customer;
use Illuminate\Auth\Notifications\ResetPassword as NotificationsResetPassword;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Support\Facades\URL;
class ResetPassword extends NotificationsResetPassword
{
/**
* The callback that should be used to create the reset password URL.
*
* @var \Closure|null
*/
public static $createUrlCallback;
/**
* ResetPassword
*
* @param string $token
* @return void
*/
public function __construct(string $token)
{
parent::__construct($token);
static::$createUrlCallback = function ($notifiable, $token) {
return \url(URL::temporarySignedRoute(
'password.reset',
now()->addHours(24),
[
'token' => $token,
'email' => $notifiable->getEmailForPasswordReset(),
],
false
));
};
}
/**
* Build the mail representation of the notification.
*

View file

@ -4,9 +4,39 @@ namespace App\Notifications\Customer;
use Illuminate\Auth\Notifications\VerifyEmail as NotificationsVerifyEmail;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\URL;
class VerifyEmail extends NotificationsVerifyEmail
{
/**
* The callback that should be used to create the reset password URL.
*
* @var \Closure|null
*/
public static $createUrlCallback;
/**
* VerifyEmail
*
* @return void
*/
public function __construct()
{
static::$createUrlCallback = function ($notifiable) {
return \url(URL::temporarySignedRoute(
'verification.verify',
Carbon::now()->addMinutes(Config::get('auth.verification.expire', 60)),
[
'id' => $notifiable->getKey(),
'hash' => sha1($notifiable->getEmailForVerification()),
],
false
));
};
}
/**
* Build the mail representation of the notification.
*