2016-03-21 85 views
4

用戶註冊後,我需要負擔一個用戶可以用來重新發送註冊的鏈接。如何獲取註冊令牌?

由於我必須在鏈接中傳遞令牌,我將如何生成該令牌?

return redirect()->route('frontend.index')->withFlashSuccess(trans('exceptions.frontend.auth.confirmation.resend')); 

我怎麼會傳遞令牌反式:

ex: http://dmain.com/account/confirm/resend/:token 

此外,在RegistersUsers

public function register(RegisterRequest $request) 
    { 
     if (config('access.users.confirm_email')) { 
      $user = $this->user->create($request->all()); 
      event(new UserRegistered($user)); 
      return redirect()->route('frontend.index')->withFlashSuccess(trans('exceptions.frontend.auth.confirmation.resend')); 
     } else { 
      auth()->login($this->user->create($request->all())); 
      event(new UserRegistered(access()->user())); 
      return redirect($this->redirectPath()); 
     } 
    } 

因此,如生成的鏈接?

'resend' => 'Your account is not confirmed. Please click the confirmation link in your e-mail, or <a href="' . route('account.confirm.resend', ':token') . '">click here</a> to resend the confirmation e-mail.', 
+0

您可以通過嘗試'csrf_token()'函數 –

回答

1

我發現如何通過傳遞變量數組這樣做:

return redirect()->route('frontend.index')->withFlashSuccess(trans('exceptions.frontend.auth.confirmation.resend', array('token' => $token))); 
0

可以保存_token您註冊時的請求得到(令牌使用形式csrf_token()產生)。而且這個令牌可以嵌入到鏈接中以驗證用戶。

相關問題