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


PHP Password::sendResetLink方法代码示例

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


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

示例1: 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', 'username' =>'required']);
     /*
             $response = Password::sendResetLink($request->only('email'), function (Message $message) {
                 $message->subject($this->getEmailSubject());
             });
     */
     $this->validate($request, ['email' => 'required|email', 'username' => 'required']);
     $correo = DB::table('users')->where('username', '=', $request->username)->first();
     if (is_null($correo)) {
         $response = Password::INVALID_USER;
     } else {
         if ($correo->email == $request->email) {
             $response = Password::sendResetLink($request->only('email'), function (Message $message) {
                 $message->subject($this->getEmailSubject());
             });
         } else {
             $response = Password::INVALID_USER;
         }
     }
     switch ($response) {
         case Password::RESET_LINK_SENT:
             session()->flash('flash_message', 'Se ha enviado un correo a la dirección de correo asociada.');
             return view('auth.password');
         case Password::INVALID_USER:
             //session()->flash('flash_message_danger', 'No existe un usuario con ese nombre.');
             return redirect()->back()->withErrors(['email' => trans($response)]);
     }
 }
开发者ID:johanWP,项目名称:pandora,代码行数:36,代码来源:PasswordController.php

示例2: postEmail

 /**
  * Send a reset link to the given user.
  * Overwritten function of ResetsPassword trait.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return void
  */
 public function postEmail(Request $request)
 {
     $this->validate($request, ['email' => 'required|email']);
     $response = Password::sendResetLink($request->only('email'), function (Message $message) {
         $message->subject(trans('password-recovery.email-title'));
     });
 }
开发者ID:Rap-Battle-App,项目名称:Backend,代码行数:14,代码来源:PasswordController.php

示例3: postEmail

 /**
  * @param  Request                                   $request
  * @throws GeneralException
  * @return $this|\Illuminate\Http\RedirectResponse
  */
 public function postEmail(Request $request)
 {
     /**
      * First of all check if the input is a valid email
      */
     $this->validate($request, ['email' => 'required|email']);
     /**
      * Make sure user is confirmed before resetting password.
      */
     $user = User::where('email', $request->get('email'))->first();
     if ($user) {
         if ($user->confirmed == 0) {
             throw new GeneralException('Your account is not confirmed. Please click the confirmation link in your e-mail, or ' . '<a href="' . route('account.confirm.resend', $user->id) . '">click here</a>' . ' to resend the confirmation e-mail.');
         }
     } else {
         throw new GeneralException('There is no user with that e-mail address.');
     }
     $response = Password::sendResetLink($request->only('email'), function (Message $message) {
         $message->subject($this->getEmailSubject());
     });
     switch ($response) {
         case Password::RESET_LINK_SENT:
             return redirect()->back()->with('status', trans($response));
         case Password::INVALID_USER:
             return redirect()->back()->withErrors(['email' => trans($response)]);
     }
 }
开发者ID:binaryk,项目名称:terenuripedia,代码行数:32,代码来源:PasswordController.php

示例4: postEmail

 public function postEmail(Request $request)
 {
     $this->validate($request, ['email' => 'required']);
     $response = Password::sendResetLink($request->only('email'), function ($message) {
         $message->subject('Password Reminder');
     });
     switch ($response) {
         case Password::RESET_LINK_SENT:
             return redirect()->back()->with('status', trans($response));
             // return Response::json(array(
             //     'error'=>false,
             //     'content'=>trans($response),
             //     'email'=>$request->input('email')
             //     ),200);
         // return Response::json(array(
         //     'error'=>false,
         //     'content'=>trans($response),
         //     'email'=>$request->input('email')
         //     ),200);
         case Password::INVALID_USER:
             return redirect()->back()->withErrors(['email' => trans($response)]);
             //         return Response::json(array(
             // 'error'=>true,
             // 'content'=>trans($response),
             // 'email'=>$request->input('email')
             // ),200);
     }
 }
开发者ID:ashdcci,项目名称:doorchat,代码行数:28,代码来源:PasswordController.php

示例5: 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']);
     $email = $request->input('email');
     $user = $this->user->pushCriteria(new UserWhereEmailEquals($email))->all()->first();
     Audit::log(null, trans('passwords.audit-log.category'), trans('passwords.audit-log.msg-request-reset', ['email' => $email]));
     if (is_null($user)) {
         Flash::error(trans(Password::INVALID_USER));
         return redirect()->back();
     } elseif ($user->auth_type !== 'internal') {
         Flash::error(trans('passwords.auth_type'));
         return redirect()->back();
     } else {
         $response = Password::sendResetLink($request->only('email'), function (Message $message) {
             $message->subject($this->getEmailSubject());
         });
         switch ($response) {
             case Password::RESET_LINK_SENT:
                 Flash::success(trans($response));
                 return redirect()->back()->with('status', trans($response));
             case Password::INVALID_USER:
                 Flash::error(trans($response));
                 return redirect()->back()->withErrors(['email' => trans($response)]);
         }
     }
 }
开发者ID:sroutier,项目名称:laravel-5.1-enterprise-starter-kit,代码行数:32,代码来源:PasswordController.php

示例6: postEmail

 /**
  * Send a reset link to the given user.
  *
  * @param ResetRequest $request
  * @return \Illuminate\Http\Response
  */
 public function postEmail(ResetRequest $request)
 {
     $response = Password::sendResetLink($request->only('email'), function (Message $message) {
         $message->subject($this->getEmailSubject());
     });
     switch ($response) {
         case Password::RESET_LINK_SENT:
             return redirect()->back()->with('status', trans($response));
         case Password::INVALID_USER:
             return redirect()->back()->withErrors(['email' => trans($response)]);
     }
 }
开发者ID:SocietyCMS,项目名称:User,代码行数:18,代码来源:PasswordController.php

示例7: getResetPassword

 public function getResetPassword(ResetPassRequest $request)
 {
     $response = Password::sendResetLink($request->only('email'), function (Message $message) {
         $message->subject('Recuperación de contraseña.');
     });
     switch ($response) {
         case Password::RESET_LINK_SENT:
             return $this->simpleArray(['message' => 'Se ha enviado un correo electrónico a su cuenta con instrucciones para recuperar su contraseña.']);
         case Password::INVALID_USER:
             throw new ResourceException('El usuario no existe');
     }
 }
开发者ID:joselfonseca,项目名称:laravel-admin-rest,代码行数:12,代码来源:AuthController.php

示例8: postEmail

 /**
  * Send a reset link to the given user.
  *
  * @param \Rukan\AjaxAuth\Requests\PasswordRequest $request
  * @return \Illuminate\Http\Response
  */
 public function postEmail(PasswordRequest $request)
 {
     $response = Password::sendResetLink($request->only('email'), function (Message $message) {
         $message->subject(Lang::get('passwords.subject'));
     });
     switch ($response) {
         case Password::RESET_LINK_SENT:
             return $request->ajax() ? new JsonResponse(['message' => Lang::get($response)]) : redirect()->back()->with('status', Lang::get($response));
         case Password::INVALID_USER:
             return $request->ajax() ? new JsonResponse(['message' => Lang::get($response)], 404) : redirect()->back()->withErrors(['email' => Lang::get($response)]);
     }
 }
开发者ID:khanhpnk,项目名称:sbds,代码行数:18,代码来源:ResetsPasswords.php

示例9: sendResetLinkEmail

 /**
  * @param SendResetLinkEmailRequest $request
  * @return $this|\Illuminate\Http\RedirectResponse
  */
 public function sendResetLinkEmail(SendResetLinkEmailRequest $request)
 {
     $response = Password::sendResetLink($request->only('email'), function (Message $message) {
         $message->subject(trans('strings.emails.auth.password_reset_subject'));
     });
     switch ($response) {
         case Password::RESET_LINK_SENT:
             return redirect()->back()->with('status', trans($response));
         case Password::INVALID_USER:
             return redirect()->back()->withErrors(['email' => trans($response)]);
     }
 }
开发者ID:farrukhcw,项目名称:laravel-5-boilerplate,代码行数:16,代码来源:ResetsPasswords.php

示例10: postRemind

 /**
  * Handle a POST request to remind a user of their password.
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function postRemind()
 {
     $result = Password::sendResetLink(Input::only('email'), function ($message, $user) {
         $message->subject(trans('reminders.your_password_reminder'));
     });
     switch ($result) {
         case Password::INVALID_USER:
             return Redirect::back()->with('error', trans(Password::INVALID_USER));
         case Password::RESET_LINK_SENT:
             return Redirect::back()->with('success', true);
     }
 }
开发者ID:wmk223,项目名称:site,代码行数:17,代码来源:RemindersController.php

示例11: doReset

 public function doReset(Request $request)
 {
     $response = Password::sendResetLink($request->only('email'), function (Message $message) {
         $message->subject('Your Password Reset Link');
     });
     switch ($response) {
         case Password::RESET_LINK_SENT:
             return redirect()->back()->with('status', trans($response));
         case Password::INVALID_USER:
             return redirect()->back()->withErrors(['email' => trans($response)]);
     }
     //return redirect()->route('login.index');
 }
开发者ID:RenatoTheodoro,项目名称:Test,代码行数:13,代码来源:PasswordController.php

示例12: 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']);
     $response = Password::sendResetLink($request->only('email'), function (Message $message) {
         $message->subject($this->getEmailSubject());
     });
     switch ($response) {
         case Password::RESET_LINK_SENT:
             return redirect()->back()->with('status', 'Вам было отправлено письмо с ссылкой на восстановление пароля!');
         case Password::INVALID_USER:
             return redirect()->back()->withErrors(['email' => 'Пользователь с таким e-mail не найден!']);
     }
 }
开发者ID:GorshkovNikita,项目名称:ruchaicof,代码行数:19,代码来源:ResetsPasswords.php

示例13: sendResetLink

 public function sendResetLink($email)
 {
     $response = Password::sendResetLink($email, function ($message) {
         $message->subject('Seu link para reset de senha');
     });
     switch ($response) {
         case Password::RESET_LINK_SENT:
             return redirect()->back()->with('status', 'Um email foi enviado para o reset da senha');
         case Password::INVALID_USER:
             return redirect()->back()->withErrors(['email' => 'Não existe nenhum usuário com este e-mail']);
     }
     return redirect()->back('home.index');
 }
开发者ID:RenatoTheodoro,项目名称:mahaGeo,代码行数:13,代码来源:AuthService.php

示例14: 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']);
     $response = Password::sendResetLink($request->only('email'), function (Message $message) {
         $message->subject($this->getEmailSubject());
     });
     switch ($response) {
         case Password::RESET_LINK_SENT:
             return view('auth.password', ['mensaje' => 'Se envió un correro para reestablecer su contraseña']);
         case Password::INVALID_USER:
             return redirect()->back()->withErrors(['email' => trans($response)]);
     }
 }
开发者ID:movpresupuestarios,项目名称:financiero,代码行数:19,代码来源:ResetsPasswords.php

示例15: postEmail

 public function postEmail(Request $request)
 {
     $this->validate($request, ['email' => 'required|email|max:255']);
     $response = Password::sendResetLink($request->only('email'), function (Message $message) {
         $message->subject($this->getEmailSubject());
     });
     switch ($response) {
         case Password::RESET_LINK_SENT:
             return redirect()->back()->with('message', trans($response))->with('loginTab', 'login');
         case Password::INVALID_USER:
             return redirect()->back()->withErrors(['email' => trans($response)])->with('loginTab', 'password');
     }
 }
开发者ID:RenzoCCH,项目名称:base6094275,代码行数:13,代码来源:PasswordController.php


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