2016-10-31 22 views
1

我的Laravel应用程序中添加了电子邮件验证系统。我已经使用了“jrean的”软件包。Laravel 5.3 - 会话存储未根据请求设置

现在我想覆盖VerifiesUsers特征中的getVerification()函数。为此我在RegisterController中添加了一个具有相同名称的函数。

public function getVerification(Request $request, $token) 

{  

$this->validateRequest($request); 

try { 
    UserVerification::process($request->input('email'), $token, $this->userTable()); 
} catch (UserNotFoundException $e) { 
    return redirect($this->redirectIfVerificationFails()); 
} catch (UserIsVerifiedException $e) { 
    return redirect($this->redirectIfVerified()); 
} catch (TokenMismatchException $e) { 
    return redirect($this->redirectIfVerificationFails()); 
} 

$request->session()->flash('message', 'Email address has been successfully verified'); 
return redirect($this->redirectAfterVerification()); 
} 

但是当我的函数被验证调用调用时,我收到错误“未根据请求设置会话存储”。错误。我不确定它究竟意味着什么,以及如何解决它。

回答

3

发生这种情况的原因是因为包中声明的路由没有放在web中间件中。

要解决此问题,您可以将该包中的路线添加到您的routes/web.php。该航线是:

Route::get('email-verification/error', 'Auth\[email protected]')->name('email-verification.error'); 
Route::get('email-verification/check/{token}', 'Auth\[email protected]')->name('email-verification.check'); 

的您将只需要确保您在config/app.phpJrean\UserVerification\UserVerificationServiceProvider::class,线以上的App服务提供商(但你Illuminate服务提供商的下面)。

希望这会有所帮助!

+0

谢谢队友!你确实挽救了我的另一个周末不受干扰。从来没有想过这个。你绝对应该得到这个啤酒品脱。 – SanketR