Laravel 8 Jetstream 邮箱验证“签名无效”403
Laravel 8 Jetstream email verification “invalid signature” 403
不确定 post 的哪些部分。更改密码电子邮件似乎工作正常。但是每当我点击电子邮件验证邮件时,我都会收到 403 错误。我不知道为什么?
来自 User.php
namespace App\Models;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Fortify\TwoFactorAuthenticatable;
use Laravel\Jetstream\HasProfilePhoto;
use Laravel\Sanctum\HasApiTokens;
class User extends Authenticatable implements MustVerifyEmail
{
use HasApiTokens;
use HasFactory;
use HasProfilePhoto;
use Notifiable;
use TwoFactorAuthenticatable;
protected $fillable = [
'name', 'username', 'email', 'platform','password',
];
from config\jetstream.php
'features' => [
// Features::termsAndPrivacyPolicy(),
Features::profilePhotos(),
// Features::api(),
// Features::teams(['invitations' => true]),
Features::accountDeletion(),
],
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
public function register()
{
\URL::forceScheme('https');
}
/**
* Bootstrap any application services.
public function boot()
{
//
}
}
Routes
<?php
use Illuminate\Support\Facades\Route;
use app\Http\Controllers\WeaponsController;
网络路由
您可以在此处为您的应用程序注册 Web 路由。这些
路由由组内的 RouteServiceProvider 加载
包含“web”中间件组。现在创造伟大的东西!
Route::resource('weapons', 'App\Http\Controllers\WeaponsController') ->middleware('auth');
Route::get('/', function () {
return view('welcome');
});
Route::middleware(['auth:sanctum', 'verified'])->get('/dashboard', function () {
return view('dashboard');
})->name('dashboard');
Route::get('/', function () {
return view('welcome');
});
我看到另一个 post 只有在通过代理服务器时才会发生类似的事情。我正在使用 Caddy2,这与它有什么关系吗?它坚持要我添加更多细节,但我没有更多要添加的内容。
只需取消注释 config/fortify 中的 Features::emailVerification()。php
'features' => [
Features::registration(),
Features::resetPasswords(),
Features::emailVerification(),
Features::updateProfileInformation(),
Features::updatePasswords(),
Features::twoFactorAuthentication([
'confirmPassword' => true,
]),
],
这是代理服务器。当我绕过它时,将证书直接放在它工作的 Web 服务器上。所以我沿着这条路线做了一些研究并发现了这一点:
通过在 app\Http\Middleware\TrustProxies.php 文件中添加我的代理服务器的 IP 地址
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array|string|null
*/
protected $proxies;
将最后一行更改为 protected $proxies = "Proxy servers IP address here";
照顾它。
不确定 post 的哪些部分。更改密码电子邮件似乎工作正常。但是每当我点击电子邮件验证邮件时,我都会收到 403 错误。我不知道为什么? 来自 User.php
namespace App\Models;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Fortify\TwoFactorAuthenticatable;
use Laravel\Jetstream\HasProfilePhoto;
use Laravel\Sanctum\HasApiTokens;
class User extends Authenticatable implements MustVerifyEmail
{
use HasApiTokens;
use HasFactory;
use HasProfilePhoto;
use Notifiable;
use TwoFactorAuthenticatable;
protected $fillable = [
'name', 'username', 'email', 'platform','password',
];
from config\jetstream.php
'features' => [
// Features::termsAndPrivacyPolicy(),
Features::profilePhotos(),
// Features::api(),
// Features::teams(['invitations' => true]),
Features::accountDeletion(),
],
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
public function register()
{
\URL::forceScheme('https');
}
/**
* Bootstrap any application services.
public function boot()
{
//
}
}
Routes
<?php
use Illuminate\Support\Facades\Route;
use app\Http\Controllers\WeaponsController;
网络路由 您可以在此处为您的应用程序注册 Web 路由。这些 路由由组内的 RouteServiceProvider 加载 包含“web”中间件组。现在创造伟大的东西!
Route::resource('weapons', 'App\Http\Controllers\WeaponsController') ->middleware('auth');
Route::get('/', function () {
return view('welcome');
});
Route::middleware(['auth:sanctum', 'verified'])->get('/dashboard', function () {
return view('dashboard');
})->name('dashboard');
Route::get('/', function () {
return view('welcome');
});
我看到另一个 post 只有在通过代理服务器时才会发生类似的事情。我正在使用 Caddy2,这与它有什么关系吗?它坚持要我添加更多细节,但我没有更多要添加的内容。
只需取消注释 config/fortify 中的 Features::emailVerification()。php
'features' => [
Features::registration(),
Features::resetPasswords(),
Features::emailVerification(),
Features::updateProfileInformation(),
Features::updatePasswords(),
Features::twoFactorAuthentication([
'confirmPassword' => true,
]),
],
这是代理服务器。当我绕过它时,将证书直接放在它工作的 Web 服务器上。所以我沿着这条路线做了一些研究并发现了这一点: 通过在 app\Http\Middleware\TrustProxies.php 文件中添加我的代理服务器的 IP 地址
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array|string|null
*/
protected $proxies;
将最后一行更改为 protected $proxies = "Proxy servers IP address here"; 照顾它。