当前位置: 首页>>代码示例>>PHP>>正文


PHP Password::broker方法代码示例

本文整理汇总了PHP中Illuminate\Support\Facades\Password::broker方法的典型用法代码示例。如果您正苦于以下问题:PHP Password::broker方法的具体用法?PHP Password::broker怎么用?PHP Password::broker使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Support\Facades\Password的用法示例。


在下文中一共展示了Password::broker方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sendResetLinkEmail

 public function sendResetLinkEmail(Request $request)
 {
     $this->validate($request, ['user_email' => 'required|email']);
     $broker = $this->getBroker();
     $response = Password::broker($broker)->sendResetLink($request->only('user_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:mtornero,项目名称:slowshop,代码行数:15,代码来源:PasswordController.php

示例2: subscribe

 public function subscribe(Dispatcher $events)
 {
     $events->listen(FrontUserRegistered::class, function (FrontUserRegistered $event) {
         Mail::send(new Welcome($event->user));
     });
     $events->listen(FrontUserCreatedThroughBack::class, function (FrontUserCreatedThroughBack $event) {
         Password::broker('front')->sendResetLink(['email' => $event->user->email], function (Message $message) {
             $message->subject('Welkom bij ' . config('app.url'));
         });
     });
     $events->listen(BackUserCreated::class, function (BackUserCreated $event) {
         Password::broker('back')->sendResetLink(['email' => $event->user->email], function (Message $message) {
             $message->subject('Welkom bij ' . config('app.url'));
         });
     });
 }
开发者ID:spatie-custom,项目名称:blender,代码行数:16,代码来源:EventHandler.php

示例3: reset

 /**
  * [reset description]
  * @param  [type] $request [description]
  * @return [type]          [description]
  */
 public function reset($request, $broker, $guard)
 {
     $this->validate($request, $this->getResetValidationRules());
     $credentials = $request->only('email', 'password', 'password_confirmation', 'token');
     $response = IlluminatePassword::broker($broker)->reset($credentials, function ($user, $password) use($guard) {
         $this->resetPassword($user, $password, $guard);
     });
     switch ($response) {
         case IlluminatePassword::PASSWORD_RESET:
             return $this->getResetSuccessResponse($response);
             break;
         default:
             return $this->getResetFailureResponse($request, $response);
             break;
     }
 }
开发者ID:ensphere,项目名称:authentication,代码行数:21,代码来源:Password.php

示例4: reset

 /**
  * Reset the given user's password.
  *
  * @param  \Illuminate\Http\Request $request
  * @return \Illuminate\Http\Response
  */
 public function reset(Request $request)
 {
     $this->validate($request, $this->getResetValidationRules());
     $credentials = $request->only('email', 'password', 'password_confirmation', 'token');
     $broker = $this->getBroker();
     $response = Password::broker($broker)->reset($credentials, function ($user, $password) {
         $this->resetPassword($user, $password);
     });
     switch ($response) {
         case Password::PASSWORD_RESET:
             return redirect()->route('reset.success')->withSuccess(trans($response));
             //return $this->getResetSuccessResponse($response);
         //return $this->getResetSuccessResponse($response);
         default:
             return $this->getResetFailureResponse($request, $response);
     }
 }
开发者ID:SkysoulDesign,项目名称:mirage.dev,代码行数:23,代码来源:PasswordController.php

示例5: sendResetLinkEmail

 /**
  * Send a reset link to the given user.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function sendResetLinkEmail(Request $request)
 {
     $this->validate($request, ['email' => 'required|email']);
     if (User::where('email', $request->only('email'))->where('password', '!=', '')->count() != 1) {
         return $this->getSendResetLinkEmailFailureResponse('Akun tidak ditemukan');
     }
     $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:notreal5400,项目名称:Vocomfest2016,代码行数:24,代码来源:PasswordController.php

示例6: sendResetLinkEmail

 /**
  * Send a reset link to the given user.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function sendResetLinkEmail(Request $request)
 {
     $rules = ['email' => 'required|email'];
     if (config('inoplate.account.enable_captcha')) {
         $captchaDriver = config('captcha.challenge');
         $rules[config('captcha.drivers.' . $captchaDriver . '.input')] = 'required|captcha';
     }
     $this->validate($request, $rules);
     $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:inoplate,项目名称:account,代码行数:26,代码来源:PasswordController.php

示例7: reset

 public function reset(Request $request)
 {
     $inputData = Input::all();
     $rules = array('token' => 'required', 'email' => 'required|email', 'password' => 'required|confirmed|min:6');
     $validator = Validator::make($inputData, $rules);
     if ($validator->fails()) {
         return Response::json(['success' => false, 'errors' => $validator->getMessageBag()->toArray()]);
     } else {
         $credentials = $request->only('email', 'password', 'password_confirmation', 'token');
         $broker = $this->getBroker();
         $response = Password::broker($broker)->reset($credentials, function ($user, $password) {
             $this->resetPassword($user, $password);
         });
         switch ($response) {
             case Password::PASSWORD_RESET:
                 $this->getResetSuccessResponse($response);
                 return Response::json(['success' => true, 'message' => '成功更改密碼!']);
             default:
                 $this->getResetFailureResponse($request, $response);
                 return Response::json(['success' => false, 'errors' => '異常錯誤, 請更新頁面再重試!']);
         }
     }
 }
开发者ID:keung725,项目名称:shop,代码行数:23,代码来源:PasswordController.php

示例8: sendResetLinkEmail

 /**
  * Send a reset link to the user.
  *
  * @param Request $request
  * @return \Illuminate\Http\Response
  */
 public function sendResetLinkEmail(Request $request)
 {
     /*
      * --------------------------------------------------------------------------
      * Send reset email
      * --------------------------------------------------------------------------
      * Validate input email, check if email has been registered before, get
      * default broker to find out email file location and finally send the
      * reset email to user.
      */
     $this->validate($request, ['email' => 'required|email']);
     $broker = $this->getBroker();
     $response = Password::broker($broker)->sendResetLink($request->only('email'), function (Message $message) {
         $message->subject($this->getEmailSubject());
         $message->replyTo('no-reply@infogue.id', env('MAIL_NAME', 'Infogue.id'));
     });
     switch ($response) {
         case Password::RESET_LINK_SENT:
             return $this->getSendResetLinkEmailSuccessResponse($response);
         case Password::INVALID_USER:
         default:
             return $this->getSendResetLinkEmailFailureResponse($response);
     }
 }
开发者ID:anggadarkprince,项目名称:infogue,代码行数:30,代码来源:PasswordController.php

示例9: broker

 /**
  * Get the broker to be used during password reset.
  *
  * @return \Illuminate\Support\Facades\Password
  */
 public function broker()
 {
     return Password::broker('pulsarPasswordBroker');
 }
开发者ID:syscover,项目名称:pulsar,代码行数:9,代码来源:ForgotPasswordController.php

示例10: broker

 /**
  * Get the broker to be used during password reset.
  *
  * @return \Illuminate\Contracts\Auth\PasswordBroker
  */
 public function broker()
 {
     return Password::broker();
 }
开发者ID:bryanashley,项目名称:framework,代码行数:9,代码来源:ResetsPasswords.php

示例11: reset

 public function reset(Request $request)
 {
     $this->validate($request, array('token' => 'required', 'email' => 'required|email', 'password' => 'required|confirmed|min:6'));
     $credentials = $request->only('email', 'password', 'password_confirmation', 'token');
     $broker = $this->getBroker();
     $response = Password::broker($broker)->reset($credentials, function ($user, $password) {
         $this->resetPassword($user, $password);
     });
     switch ($response) {
         case Password::PASSWORD_RESET:
             return $this->getResetSuccessResponse($response);
         default:
             return $this->getResetFailureResponse($request, $response);
     }
 }
开发者ID:babanb,项目名称:seathero_newui,代码行数:15,代码来源:compiled.php

示例12: getPasswordBroker

 /**
  * Get the broker to be used during password reset.
  *
  * @return \Illuminate\Contracts\Auth\PasswordBroker
  */
 private function getPasswordBroker()
 {
     return Password::broker();
 }
开发者ID:francescomalatesta,项目名称:laravel-api-boilerplate-jwt,代码行数:9,代码来源:ForgotPasswordController.php

示例13: proceedResetPassword

 /**
  * Handle showing form and update password
  *
  * @param  \Illuminate\Http\Request  $request
  * @param string $email
  * @param string $token
  * @return \Illuminate\Http\Response
  */
 public function proceedResetPassword(Request $request, $email = null, $token = null)
 {
     if (is_null($token)) {
         redirect(route('auth.reset_password.request'));
     }
     $resetForm = $this->createForm(PasswordResetUpdateType::class, array('email' => $email, 'token' => $token), array('action' => route('auth.reset_password.update_check')));
     $resetForm->handleRequest($request);
     if ($request->isMethod('post')) {
         if ($resetForm->isValid()) {
             $data = $resetForm->getData();
             $credentials = array('email' => $data['email'], 'password_confirmation' => $data['plainPassword'], 'password' => $data['plainPassword'], 'token' => $data['token']);
             $broker = $this->getBroker();
             // Disable default password validator
             Password::broker($broker)->validator(function () {
                 return true;
             });
             $response = Password::broker($broker)->reset($credentials, function ($user, $password) {
                 $this->resetPassword($user, $password);
             });
             switch ($response) {
                 case Password::PASSWORD_RESET:
                     return redirect($this->redirectPath())->with('status', trans('auth.message.reset_password.success'));
                 case Password::INVALID_USER:
                     return redirect($this->redirectPath())->with('status', trans('auth.message.reset_password.invalid_email'));
                 case Password::INVALID_TOKEN:
                     return redirect($this->redirectPath())->with('status', trans('auth.message.reset_password.invalid_token'));
                 default:
                     return redirect()->back()->with('status', trans('auth.message.reset_password.fail'));
             }
         }
     }
     if (property_exists($this, 'resetView')) {
         return view($this->resetView, ['form' => $resetForm->createView()]);
     }
     if (view()->exists('auth.passwords.reset')) {
         return view('auth.passwords.reset', ['form' => $resetForm->createView()]);
     }
     return view('auth.reset', ['form' => $resetForm->createView()]);
 }
开发者ID:hoangnd25,项目名称:laravel-boilerplate,代码行数:47,代码来源:PasswordController.php

示例14: broker

 /**
  * Get the broker to be used during password reset.
  *
  * @return \Illuminate\Contracts\Auth\PasswordBroker
  */
 public function broker()
 {
     return Password::broker('adminusers');
 }
开发者ID:mage2,项目名称:laravel-ecommerce,代码行数:9,代码来源:ResetPasswordController.php

示例15: reset

 /**
  * Reset the given user's password.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function reset(Request $request)
 {
     $this->validate($request, $this->getResetValidationRules(), $this->getResetValidationMessages(), $this->getResetValidationCustomAttributes());
     $credentials = $this->getResetCredentials($request);
     $broker = $this->getBroker();
     $response = Password::broker($broker)->reset($credentials, function ($user, $password) {
         $this->resetPassword($user, $password);
     });
     switch ($response) {
         case Password::PASSWORD_RESET:
             return $this->getResetSuccessResponse($response);
         default:
             return $this->getResetFailureResponse($request, $response);
     }
 }
开发者ID:timpressive,项目名称:art-auction,代码行数:21,代码来源:ResetsPasswords.php


注:本文中的Illuminate\Support\Facades\Password::broker方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。