• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Facades\Password类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: postReset

 public function postReset(Request $request)
 {
     $params = $request->only('email', 'password', 'password_confirmation', 'token');
     $filter = $this->validator($params);
     if ($filter->fails()) {
         //            return $this->responseAnswer(true, NULL, trans('rest.14'), 14, $filter->errors());
         return view('admin.reset')->with(['token' => $params['token'], 'message' => trans('auth.failed'), 'email' => $params['email'], 'error' => $filter->errors()->toArray()]);
     }
     $response = Password::reset($params, function ($user, $password) {
         $this->resetPassword($user, $password);
     });
     switch ($response) {
         case Password::PASSWORD_RESET:
             //                $this->data = [
             //                            'authenticated' => true,
             //                            'role' => Auth::user()->isAdmin ? 'admin' : 'user',
             //                        ];
             //                return $this->responseAnswer(false, $this->data, trans($response));
             return redirect('/');
         default:
             //                $this->data = [
             //                            'email' => $params['email'],
             //                            'token' => $params['token'],
             //                            'authenticated' => false,
             //                            'role' => 'guest',
             //                        ];
             //                return $this->responseAnswer(true, NULL, trans($response), 1);
             return view('admin.reset')->with(['token' => $params['token'], 'message' => $response, 'email' => $params['email']]);
     }
 }
开发者ID:NickMomchev,项目名称:bautech,代码行数:30,代码来源:PasswordController.php


示例2: 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


示例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: reset_process

 protected function reset_process($credentials)
 {
     return Password::user()->reset($credentials, function ($user, $password) {
         $user->password = bcrypt($password);
         $user->save();
         Auth::user()->login($user);
     });
 }
开发者ID:rizalafani,项目名称:Laravel-5.1-Multi-Auth-Example,代码行数:8,代码来源: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']);
     $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', 'Hemos enviando un link a tu cuenta de correo electrónico para que puedas resetear la contraseña');
         case Password::INVALID_USER:
             return redirect()->back()->withErrors(['email' => trans($response)]);
     }
 }
开发者ID:sibasbo,项目名称:sibas,代码行数:20,代码来源:PasswordController.php


示例6: 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


示例7: postReset

 /**
  * Reset the given user's password.
  * 
  * @param  ResetPasswordRequest  $request
  * @return Response
  */
 public function postReset(ResetPasswordRequest $request)
 {
     $credentials = $request->only('email', 'password', 'password_confirmation', 'token');
     $response = Password::reset($credentials, function ($user, $password) {
         $this->resetPassword($user, $password);
     });
     switch ($response) {
         case Password::PASSWORD_RESET:
             return redirect()->to('/')->with('ok', trans('passwords.reset'));
         default:
             return redirect()->back()->with('error', trans($response))->withInput($request->only('email'));
     }
 }
开发者ID:cptsky,项目名称:laravel5-example,代码行数:19,代码来源:PasswordController.php


示例8: postReset

 /**
  * Reset the given user's password.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function postReset(Request $request)
 {
     $this->validate($request, ['token' => 'required', 'email' => 'required|email', 'password' => 'required|confirmed|min:6']);
     $credentials = $request->only('email', 'password', 'password_confirmation', 'token');
     $response = Password::reset($credentials, function ($user, $password) {
         $this->resetPassword($user, $password);
     });
     if ($response == Password::PASSWORD_RESET) {
         return response()->json(["msg" => "Success", "data" => true], 200);
     } else {
         return response()->json(["msg" => "Unknown error", "data" => $response], 400);
     }
 }
开发者ID:absis,项目名称:EsmorzarsIBenzina,代码行数:19,代码来源:PasswordController.php


示例9: reset

 /**
  * @param ResetPasswordRequest $request
  * @return $this|\Illuminate\Http\RedirectResponse
  */
 public function reset(ResetPasswordRequest $request)
 {
     $credentials = $request->only('email', 'password', 'password_confirmation', 'token');
     $response = Password::reset($credentials, function ($user, $password) {
         $this->resetPassword($user, $password);
     });
     switch ($response) {
         case Password::PASSWORD_RESET:
             return redirect($this->redirectPath())->with('status', trans($response));
         default:
             return redirect()->back()->withInput($request->only('email'))->withErrors(['email' => trans($response)]);
     }
 }
开发者ID:farrukhcw,项目名称:laravel-5-boilerplate,代码行数:17,代码来源:ResetsPasswords.php


示例10: postEmail

 public function postEmail(PasswordRequest $request)
 {
     $response = Password::sendResetLink($request->only('email'), function (Message $message) {
         $message->subject($this->getEmailSubject());
     });
     switch ($response) {
         case Password::RESET_LINK_SENT:
             Session::flash('message', 'Link de recuperación enviado por correo');
             return redirect()->back()->with('status', trans($response));
         case Password::INVALID_USER:
             return redirect()->back()->withErrors(['email' => trans($response)]);
     }
 }
开发者ID:franciscoBarrientos,项目名称:laravel,代码行数:13,代码来源:PasswordController.php


示例11: doReset

 /**
  * Reset the given user's password.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function doReset(ResetPasswordRequest $request)
 {
     $credentials = $request->only('email', 'password', 'password_confirmation', 'token');
     $response = Password::reset($credentials, function ($user, $password) {
         $user->password = bcrypt($password);
         $user->save();
     });
     switch ($response) {
         case Password::PASSWORD_RESET:
             return $this->simpleArray(['message' => 'Se ha actualizado su contraseña.']);
         default:
             throw new ResourceException('No hemos podido restaurar su contraseña, verifique la información enviada.');
     }
 }
开发者ID:joselfonseca,项目名称:laravel-admin-rest,代码行数:20,代码来源:AuthController.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:
             Session::flash('flash_message', 'Reset Link was successfully sent to your email');
             return redirect()->back()->with('status', trans($response));
         case Password::INVALID_USER:
             return redirect()->back()->withErrors(['email' => trans($response)]);
     }
 }
开发者ID:Jemok,项目名称:ba_hosting,代码行数:20,代码来源:PasswordController.php


示例13: postReset

 /**
  * Reset the given user's password.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function postReset(Request $request)
 {
     $this->validate($request, ['token' => 'required', 'email' => 'required|email', 'password' => 'required|confirmed|min:6']);
     $credentials = $request->only('email', 'password', 'password_confirmation', 'token');
     $response = Password::reset($credentials, function ($user, $password) {
         $this->resetPassword($user, $password);
     });
     switch ($response) {
         case Password::PASSWORD_RESET:
             return redirect()->route('basecamp::login');
         default:
             abort(500, 'Invalid operation (User / Password / Token).');
     }
 }
开发者ID:patrikkernke,项目名称:basecamp-modules,代码行数:20,代码来源:PasswordController.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->from('[email protected]', $name = 'Smart Ads');
         $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:IzakRammah,项目名称:SmartAds,代码行数:20,代码来源:PasswordController.php


示例15: postReset

 /**
  * Reset the given user's password.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function postReset(Request $request)
 {
     $this->validate($request, ['token' => 'required', 'password' => 'required|confirmed|min:6|max:16']);
     $credentials = $request->only('password', 'password_confirmation', 'token');
     $response = Password::reset($credentials, function ($user, $password) {
         $this->resetPassword($user, $password);
     });
     switch ($response) {
         case Password::PASSWORD_RESET:
             return redirect()->back()->with('successReset', [1]);
         default:
             return redirect()->back()->withErrors(['token' => trans($response)]);
     }
 }
开发者ID:kyxer,项目名称:barriosLaravel,代码行数:20,代码来源:PasswordController.php


示例16: postReset

 /**
  * Reset the given user's password.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function postReset(Request $request)
 {
     $this->validate($request, ['token' => 'required', 'email' => 'required|email', 'password' => 'required|confirmed']);
     $credentials = $request->only('email', 'password', 'password_confirmation', 'token');
     $response = Password::reset($credentials, function ($user, $password) {
         $this->resetPassword($user, $password);
     });
     switch ($response) {
         case Password::PASSWORD_RESET:
             return redirect(config('backend.backend.base_url') . '/dashboard');
         default:
             return redirect()->back()->withInput($request->only('email'))->withErrors(['email' => trans($response)]);
     }
 }
开发者ID:darryldecode,项目名称:laravelbackend,代码行数:20,代码来源:PasswordController.php


示例17: postReset

 /**
  * Reset the given user's password.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function postReset(Request $request)
 {
     $this->validate($request, ['token' => 'required', 'email' => 'required|email', 'password' => 'required|confirmed|min:6']);
     $credentials = $request->only('email', 'password', 'password_confirmation', 'token');
     $response = Password::reset($credentials, function ($user, $password) {
         $this->resetPassword($user, $password);
     });
     switch ($response) {
         case Password::PASSWORD_RESET:
             return new JsonResponse([], 200);
         default:
             return new JsonResponse(['error' => trans($response)], 422);
     }
 }
开发者ID:thecsea,项目名称:laravel-noredirect-traits,代码行数:20,代码来源:ResetsPasswords.php


示例18: postReset

 /**
  * Reset the given user's password.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function postReset(Request $request)
 {
     $this->validate($request, ['token' => 'required', 'email' => 'required|email', 'password' => 'required|min:8|confirmed'], ['email.required' => 'Sähköpostiosoite vaaditaan varmuuden vuoksi.', 'email.email' => 'Annettu sähköpostiosoite ei ole pätevä.', 'password.required' => 'Salasana puuttuu.', 'password.min' => 'Salasanan pitää olla vähintään :min merkkiä pitkä.', 'password.confirmed' => 'Salasanat eivät täsmää.']);
     $credentials = $request->only('email', 'password', 'password_confirmation', 'token');
     $response = Password::reset($credentials, function ($user, $password) {
         $this->resetPassword($user, $password);
     });
     switch ($response) {
         case Password::PASSWORD_RESET:
             return redirect($this->redirectPath())->with('status', trans($response));
         default:
             return redirect()->back()->withInput($request->only('email'))->withErrors(['email' => trans($response)]);
     }
 }
开发者ID:Orvo,项目名称:mlraamattu,代码行数:20,代码来源:ResetsPasswords.php


示例19: reset

 /**
  * Reset the given user's password.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function reset(Request $request)
 {
     $this->validate($request, ['token' => 'required', 'email' => 'required|email', 'password' => 'required|confirmed|min:6']);
     $credentials = $request->only('email', 'password', 'password_confirmation', 'token');
     $response = Password::reset($credentials, function ($user, $password) {
         $this->resetPassword($user, $password);
     });
     switch ($response) {
         case Password::PASSWORD_RESET:
             return redirect('login')->with('status', trans($response))->with('success', 'Your password has been reset, you can now log in.');
         default:
             return redirect()->back()->withInput($request->only('email'))->withErrors(['email' => trans($response)])->with('error', 'An error has occured, please try again.');
     }
 }
开发者ID:Shoodey,项目名称:Events,代码行数:20,代码来源:PasswordController.php


示例20: postReset

 public function postReset(Request $request)
 {
     $this->validate($request, ['token' => 'required', 'email' => 'required|email', 'password' => 'required|confirmed|min:6']);
     $credentials = $request->only('email', 'password', 'password_confirmation', 'token');
     $response = Password::reset($credentials, function ($user, $password) {
         $this->resetPassword($user, $password);
     });
     switch ($response) {
         case Password::PASSWORD_RESET:
             return redirect()->route('auth.password_reminder.getEmail')->with('status', trans($response));
         default:
             return redirect()->back()->withInput($request->only('email'))->withErrors(['email' => trans($response)]);
     }
 }
开发者ID:r3k4,项目名称:ujianonline,代码行数:14,代码来源:PasswordController.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Facades\Redirect类代码示例发布时间:2022-05-23
下一篇:
PHP Facades\Mail类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap