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


PHP Password::reset方法代码示例

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


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

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

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

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

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

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

示例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);
     });
     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

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

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

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

示例13: 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:
             /* customization: set 'flash_message' session var instead of 'status' */
             return redirect($this->redirectPath())->with('flash_message', trans($response));
         default:
             return redirect()->back()->withInput($request->only('email'))->withErrors(['email' => trans($response)]);
     }
 }
开发者ID:absent1706,项目名称:laravel-minihabr,代码行数:15,代码来源:PasswordController.php

示例14: 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');
     $credentials['department_id'] = $this->getDepartment()->id;
     $response = Password::reset($credentials, function ($user, $password) {
         $this->resetPassword($user, $password);
     });
     switch ($response) {
         case Password::PASSWORD_RESET:
             return redirect($this->redirectPath())->with('success', 'password-changed');
         default:
             return redirect()->back()->withInput($request->only('email'))->withErrors(['email' => trans($response)]);
     }
 }
开发者ID:Tisho84,项目名称:conference,代码行数:15,代码来源:PasswordController.php

示例15: reset

 /**
  * Reset the given user's password.
  *
  * @param \Illuminate\Http\Request $request
  *
  * @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function reset(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) {
         $user->password = $password;
         $user->save();
     });
     switch ($response) {
         case Password::PASSWORD_RESET:
             Session::flash('message', ['type' => 'success', 'content' => trans('user::account.change_password_success')]);
             return redirect(route('auth.login'));
         default:
             return redirect()->back()->withInput($request->only('email'))->withErrors(['email' => trans($response), 'msg' => trans($response)]);
     }
 }
开发者ID:minhbang,项目名称:laravel-simple-user,代码行数:23,代码来源:PasswordController.php


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