当前位置: 首页>>代码示例>>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;未经允许,请勿转载。