【发布时间】:2021-05-21 20:25:21
【问题描述】:
我想寻求帮助,因为我不知道如何告诉用户激活链接不正确。
我覆盖了验证方法,现在,成功激活后,用户会收到信息。但是当链接无效时得到 403 |签名无效。
我的想法已经用完了,我想将消息的形式更改为登录页面上显示的引导警报
protected $redirectTo = '/login';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('signed')->only('verify');
$this->middleware('throttle:6,1')->only('verify', 'resend');
}
public function verify(Request $request)
{
$user = User::find($request->route('id'));
if (!hash_equals((string) $request->route('hash'), sha1($user->getEmailForVerification()))) {
throw new AuthorizationException;
}
if ($user->markEmailAsVerified())
event(new Verified($user));
return redirect($this->redirectPath())->with('verified', true);
}
我试过try catch但没用
有人知道如何实现吗??我正在使用 Laravel 8
【问题讨论】: