2016-08-18 128 views
1

我這樣做:Laravel自定義密碼重置

public function ForgotPassword(Request $request) { 
     $template_data = [ 
      'template' => $this->template->ConstructArrayTemplate() 
     ];  

     $rules = ['email' => 'required|exists:accounts|email']; 

     $validator = Validator::make($request->all(), $rules); 
     $errors = $this->sortErrors ($validator, array('email')); 

     if ($errors) { 
      $template_data [ 'Errs' ] = $errors; 
      $template_data [ 'template' ] [ 'page_name' ] = 'Sign up'; 

      return view('forgot_password', $template_data); 
     } 

     $response = $this->passwords->sendResetLink($request->only('email')); 

     switch ($response) 
     { 
      case PasswordBroker::RESET_LINK_SENT: 
       return redirect(''); 
     } 
    } 

而且由於:

$response = $this->passwords->sendResetLink($request->only('email')); 

我得到一個錯誤:

InvalidArgumentException in FileViewFinder.php line 137: View [auth.emails.password] not found.

+0

檢查你是否有這個文件:'resources/views/auth/emails/password.blade.php' –

+0

如果我想要另一個路徑? –

回答

0

爲了有一個密碼重置電子郵件發送,您需要提供一個用於生成電子郵件內容的視圖。

你應該把這個模板放在resources/views/auth/emails/password.blade.php

在此模板中,您可以引用重置令牌爲$令牌和用戶對象$用戶

+0

如果我想要另一條路徑? –

+0

另一種途徑...?例如 –

+0

,我想要email.forgotpassword –