Laravel 8 Jetstream 电子邮件验证“无效签名” 403

问题描述

不确定要发布哪些部分。更改密码电子邮件似乎工作正常。但是,每当我单击电子邮件验证电子邮件时,都会收到 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');
    });

我看到另一篇帖子,其中只有通过代理服务器才会发生类似的事情。我正在使用 Caddy2,这与它有什么关系吗?它坚持要我添加更多细节,但我没有什么要添加的了。

解决方法

这是代理服务器。当我绕过它时,将证书直接放在它工作的 Web 服务器上。所以我沿着这条路线做了一些研究并发现了这一点:https://stackoverflow.com/a/28798341/15361400 通过在 app\Http\Middleware\TrustProxies.php 文件中添加我的代理服务器的 IP 地址

import numpy as np
import matplotlib.pyplot as plt

olho=plt.imread('training/images/29_training.tif')
olho_verde=olho[:,:,1]

teste=np.copy(olho_verde)

incidencia=np.zeros((teste.size)) 
ocorrencia=np.zeros(256)
k=0
for i in range(584):
    for j in range(565):
        incidencia[k]=teste[i,j] #all image intensities
        k=k+1
count=0
for i in range(256): # how many times each intensity occurs for a total number of pixels of 255
    for j in range(len(incidencia)):
        if incidencia[j]==i:
            count=count+1
    ocorrencia[i]=count
    count=0

acumulado=np.zeros(256) #down here I have the algorithm so with histogram and image plot
count=0
for i in range(256):
    count=count+ocorrencia[i]
    acumulado[i]=count
        
constante=255/(584*565)

for i in range(256):
    acumulado[i]=round(acumulado[i]*constante,0)
    
plt.figure(figsize=(20,8))    
plt.hist(acumulado,256,[0,256])
plt.show

equaliza=np.copy(olho_verde)
i1,j1=np.nonzero(equaliza)

for i in range(256):
    for j in range(len(i1)):
        if(equaliza[i1[j],j1[j]]==i):
            equaliza[i1[j],j1[j]]=acumulado[i]
            
plt.imshow(equaliza)

将最后一行更改为 protected $proxies = "此处的代理服务器 IP 地址"; 照顾它。

,

在 config/fortify.php 中取消对 Features::emailVerification() 的注释

'features' => [
        Features::registration(),Features::resetPasswords(),Features::emailVerification(),Features::updateProfileInformation(),Features::updatePasswords(),Features::twoFactorAuthentication([
            'confirmPassword' => true,]),],