當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Password::broker方法代碼示例

本文整理匯總了PHP中Password::broker方法的典型用法代碼示例。如果您正苦於以下問題:PHP Password::broker方法的具體用法?PHP Password::broker怎麽用?PHP Password::broker使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Password的用法示例。


在下文中一共展示了Password::broker方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: sendResetLinkEmail

 public function sendResetLinkEmail(Request $request)
 {
     $this->validate($request, ['email' => 'required|email']);
     $broker = $this->getBroker();
     $response = Password::broker($broker)->sendResetLink($request->only('email'), function (Message $message) {
         $message->subject($this->getEmailSubject());
     });
     switch ($response) {
         case Password::RESET_LINK_SENT:
             return $this->getSendResetLinkEmailSuccessResponse($response);
         case Password::INVALID_USER:
         default:
             return $this->getSendResetLinkEmailFailureResponse($response);
     }
 }
開發者ID:angelobiscola,項目名稱:lv2-set-up-multipl-users-and-modularized,代碼行數:15,代碼來源:ResetsPassword.php

示例2: postReset

 /**
  * Handle a POST request to reset a user's password.
  *
  * @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse
  */
 public function postReset(Request $request)
 {
     $form = FormBuilder::create('Distilleries\\Expendable\\Forms\\Login\\Forgotten');
     if ($form->hasError()) {
         return $form->validateAndRedirectBack();
     }
     $credentials = $request->only('email', 'password', 'password_confirmation', 'token');
     $broker = $this->getBroker();
     $response = \Password::broker($broker)->reset($credentials, function ($user, $password) {
         $user->password = bcrypt($password);
         $user->save();
         if (method_exists($user, 'unlock')) {
             $user->unlock();
         }
         $this->auth->login($user);
     });
     switch ($response) {
         case \Password::INVALID_PASSWORD:
         case \Password::INVALID_TOKEN:
         case \Password::INVALID_USER:
             return redirect()->back()->with('error', trans($response));
         case \Password::PASSWORD_RESET:
             return redirect()->to(action('\\' . get_class($this) . '@getIndex'));
     }
 }
開發者ID:SchizoDuckie,項目名稱:Expendable,代碼行數:30,代碼來源:LoginController.php

示例3: postEmail

 /**
  * Send a reset link to the given user.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function postEmail(Request $request)
 {
     // $this->validate($request, ['email' => 'required|email|exists:' . zbase_config_get('entity.user.table.name') . ',email']);
     $entity = zbase()->entity('user', [], true);
     $user = $entity->repo()->by('email', zbase_request_input('email'))->first();
     if (!empty($user)) {
         $broker = $this->getBroker();
         $response = \Password::broker($broker)->sendResetLink($this->getSendResetLinkEmailCredentials($request), $this->resetEmailBuilder());
         $user->lostPassword();
     }
     zbase()->json()->setVariable('password_success', 1);
     zbase()->json()->setVariable('_redirect', zbase_url_previous());
     if (!zbase_is_json()) {
         return redirect()->back()->with('status', trans(\Password::RESET_LINK_SENT));
     }
 }
開發者ID:claremontdesign,項目名稱:zbase,代碼行數:22,代碼來源:PasswordController.php


注:本文中的Password::broker方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。