當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。