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


PHP Password::reset方法代码示例

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


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

示例1: resetPassword

 protected function resetPassword($credentials)
 {
     return Password::reset($credentials, function ($user, $pass) {
         $user->password = Hash::make($pass);
         $user->save();
     });
 }
开发者ID:shinichi81,项目名称:laravel-4-authentication,代码行数:7,代码来源:UserController.php

示例2: resetAction

 public function resetAction()
 {
     $token = "?token=" . Input::get("token");
     $errors = new MessageBag();
     if ($old = Input::old("errors")) {
         $errors = $old;
     }
     $data = ["token" => $token, "errors" => $errors];
     if (Input::server("REQUEST_METHOD") == "POST") {
         $validator = Validator::make(Input::all(), ["email" => "required|email", "password" => "required|min:6", "password_confirmation" => "required|same:password", "token" => "required|exists:token,token"]);
         if ($validator->passes()) {
             $credentials = ["email" => Input::get("email")];
             Password::reset($credentials, function ($user, $password) {
                 $user->password = Hash::make($password);
                 $user->save();
                 Auth::login($user);
                 return Redirect::route("user/profile");
             });
         }
         $data["email"] = Input::get("email");
         $data["errors"] = $validator->errors();
         return Redirect::to(URL::route("user/reset") . $token)->withInput($data);
     }
     return View::make("user/reset", $data);
 }
开发者ID:alejandromorg,项目名称:Inventario,代码行数:25,代码来源:UserController.php

示例3: postReset

 /**
  * Handle a POST request to reset a user's password.
  *
  * @return Response
  */
 public function postReset()
 {
     $post = Input::all();
     $rules = array('email' => 'required|email', 'password' => 'required', 'password_confirmation' => 'required');
     $validator = Validator::make($post, $rules);
     if ($validator->fails()) {
         return Redirect::to('recordar/form/' . $post['token'])->withErrors($validator)->withInput();
     } else {
         $credentials = Input::only('email', 'password', 'password_confirmation', 'token');
         $response = Password::reset($credentials, function ($user, $password) {
             $user->password = Hash::make($password);
             $user->password_changed = true;
             $user->save();
         });
         switch ($response) {
             case Password::INVALID_PASSWORD:
             case Password::INVALID_TOKEN:
             case Password::INVALID_USER:
                 return Redirect::back()->with('error', Lang::get($response));
             case Password::PASSWORD_RESET:
                 Session::flash('success', 'Su contraseña ha sido cambiada exitósamente.');
                 return Redirect::to('login');
         }
     }
 }
开发者ID:frankpaul142,项目名称:cloudinventory,代码行数:30,代码来源:RemindersController.php

示例4: postReset

 /**
  * Reset the given user's password.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function postReset(Request $request)
 {
     $messages = ['email.exists' => 'Invalid token given.'];
     $this->validate($request, ['token' => 'required', 'email' => 'required|email|exists:user_tokens,email,token,' . zbase_request_input('token', '_'), 'password' => 'required|confirmed|min:6|same:password_confirmation'], $messages);
     $credentials = $request->only('email', 'password', 'password_confirmation', 'token');
     $response = \Password::reset($credentials, function ($user, $password) {
         $user->updatePassword($password);
         $this->resetPassword($user, $password);
     });
     switch ($response) {
         case \Password::PASSWORD_RESET:
             if ($this->loginAfterReset()) {
                 zbase_alert(\Zbase\Zbase::ALERT_SUCCESS, 'You successfully updated your password.');
             } else {
                 zbase_alert(\Zbase\Zbase::ALERT_SUCCESS, 'You successfully updated your password. You can login now.');
             }
             zbase()->json()->setVariable('_redirect', $this->redirectPath());
             zbase()->json()->setVariable('password_reset_success', 1);
             return redirect($this->redirectPath())->with('status', trans($response));
         case 'passwords.token':
             zbase_alert(\Zbase\Zbase::ALERT_ERROR, 'Token doesn\'t match, expired or not found. Kindly check again.');
         default:
             return redirect()->back()->withInput($request->only('email'))->withErrors(['email' => trans($response)]);
     }
 }
开发者ID:claremontdesign,项目名称:zbase,代码行数:31,代码来源:PasswordController.php

示例5: update

 public function update()
 {
     $credentials = Input::only(['email', 'token', 'password', 'password_confirmation']);
     \Password::reset($credentials, function ($user, $password) {
         $user->password = Hash::make($password);
         $user->save();
     });
     return View::make('users.login')->with('success', 'Your password has been reset successfully.');
 }
开发者ID:remix101,项目名称:compex,代码行数:9,代码来源:PasswordController.php

示例6: handleReset

 public function handleReset()
 {
     $credentials = array('email' => Input::get('email'), 'password' => Input::get('password'), 'password_confirmation' => Input::get('password_confirmation'));
     return Password::reset($credentials, function ($user, $password) {
         $user->password = Hash::make($password);
         $user->save();
         Session::forget('email');
         return Redirect::to('login')->with("flash_message_good", "Your password has been successfully changed, login here.");
     });
 }
开发者ID:s-matic,项目名称:collab-consumption,代码行数:10,代码来源:PasswordController.php

示例7: postReset

 /**
  * Handle a POST request to reset a user's password.
  *
  * @return Response
  */
 public function postReset()
 {
     $credentials = Input::only('email', 'password', 'password_confirmation', 'token');
     $response = Password::reset($credentials, function ($user, $password) {
         $user->password = $password;
         $user->save();
     });
     switch ($response) {
         case Password::INVALID_PASSWORD:
         case Password::INVALID_TOKEN:
         case Password::INVALID_USER:
             return Redirect::route('password.reset')->with('error', 'Whoops something went terribily wrong! Please retry');
         case Password::PASSWORD_RESET:
             return Redirect::route('auth.getLogin')->with('message', 'Password successfully updated. Now log in')->with('messageType', 'success');
     }
 }
开发者ID:gamerwalt,项目名称:laravelsnippets,代码行数:21,代码来源:RemindersController.php

示例8: postReset

 /**
  * Handle a POST request to reset a user's password.
  *
  * @return Response
  */
 public function postReset()
 {
     $credentials = array('login' => Input::get('usuario'), 'password' => Input::get('password'), 'password_confirmation' => Input::get('password_confirmation'), 'token' => Input::get('token'));
     $response = Password::reset($credentials, function ($user, $password) {
         $user->password = Hash::make($password);
         $user->save();
     });
     switch ($response) {
         case Password::INVALID_PASSWORD:
         case Password::INVALID_TOKEN:
         case Password::INVALID_USER:
             return Redirect::back()->with('message_danger', Lang::get($response));
         case Password::PASSWORD_RESET:
             return Redirect::to('/');
     }
 }
开发者ID:absabbath,项目名称:padron-beneficiarios,代码行数:21,代码来源:RemindersController.php

示例9: postReset

 /**
  * Handle a POST request to reset a user's password.
  *
  * @return Response
  */
 public function postReset()
 {
     $credentials = Input::only('email', 'password', 'password_confirmation', 'token');
     $response = Password::reset($credentials, function ($user, $password) {
         $user->password = $password;
         $user->save();
     });
     switch ($response) {
         case Password::INVALID_PASSWORD:
         case Password::INVALID_TOKEN:
         case Password::INVALID_USER:
             return Response::json($this->growlMessage(Lang::get($response), 'error'));
         case Password::PASSWORD_RESET:
             return Response::json($this->growlMessage('Password changed successfully.', 'success'));
     }
 }
开发者ID:ritvikgautam,项目名称:madison,代码行数:21,代码来源:RemindersController.php

示例10: postReset

 /**
  * Handle a POST request to reset a user's password.
  *
  * @return Response
  */
 public function postReset()
 {
     $credentials = Input::only('email', 'password', 'password_confirmation', 'token');
     $response = Password::reset($credentials, function ($user, $password) {
         $user->password = Hash::make($password);
         $user->save();
     });
     switch ($response) {
         case Password::INVALID_PASSWORD:
         case Password::INVALID_TOKEN:
         case Password::INVALID_USER:
             return Redirect::back()->with('alert', array('type' => 'error', 'content' => 'Błąd! Sprawdź wszystkie pola.'));
         case Password::PASSWORD_RESET:
             return Redirect::to('/')->with('alert', array('type' => 'success', 'content' => 'Hasło zostało zmienione!'));
     }
 }
开发者ID:itsfamestudio,项目名称:hashtag,代码行数:21,代码来源:RemindersController.php

示例11: postReset

 /**
  * Handle a POST request to reset a user's password.
  *
  * @return Response
  */
 public function postReset()
 {
     $credentials = Input::only('email', 'password', 'password_confirmation', 'token');
     $response = Password::reset($credentials, function ($profesor, $password) {
         $profesor->password = $password;
         $profesor->forceSave();
     });
     switch ($response) {
         case Password::INVALID_PASSWORD:
         case Password::INVALID_TOKEN:
         case Password::INVALID_USER:
             return Redirect::back()->with('error', Lang::get($response));
         case Password::PASSWORD_RESET:
             return Redirect::to('login')->with('confirmacion', "Tu contraseña ha sido modificada");
     }
 }
开发者ID:SEODiaz,项目名称:SIGA-4,代码行数:21,代码来源:RemindersController.php

示例12: postPasswordReset

 public function postPasswordReset()
 {
     $token = Input::get('token');
     $validator = Validator::make(Input::all(), array("email" => "required|email|exists:password_reminders,email", "password" => "required|min:6", "password_confirmation" => "same:password", "token" => "exists:password_reminders,token"));
     if ($validator->passes()) {
         $credentials = array("email" => Input::get("email"));
         return Password::reset($credentials, function ($user, $password) {
             $user->password = Hash::make($password);
             $user->save();
             Auth::login($user);
             return Redirect::route("home");
         });
     } else {
         return Redirect::route('getPasswordReset', array($token))->withInput()->withErrors($validator);
     }
 }
开发者ID:arifai,项目名称:atoz,代码行数:16,代码来源:SiteController.php

示例13: postReset

 /**
  * Handle a POST request to reset a user's password.
  *
  * @return Response
  */
 public function postReset()
 {
     $credentials = Input::only('email', 'password', 'password_confirmation', 'token');
     $response = Password::reset($credentials, function ($user, $password) {
         $user->password = Hash::make($password);
         $user->save();
     });
     switch ($response) {
         case Password::INVALID_PASSWORD:
         case Password::INVALID_TOKEN:
         case Password::INVALID_USER:
             return Redirect::back()->with('error', Lang::get($response));
         case Password::PASSWORD_RESET:
             return Redirect::to('/admin')->withMessage('<div class="alert alert-dismissible alert-success alert-link"><button type="button" class="close" data-dismiss="alert">×</button>Password updated successfully!</div>');
     }
 }
开发者ID:adamyWA,项目名称:Menu-CMS,代码行数:21,代码来源:RemindersController.php

示例14: postReset

 /**
  * Handle a POST request to reset a user's password.
  *
  * @return Response
  */
 public function postReset()
 {
     $credentials = Input::only('email', 'password', 'password_confirmation', 'token');
     $response = Password::reset($credentials, function ($user, $password) {
         $user->password = Hash::make($password);
         $user->save();
     });
     switch ($response) {
         case Password::INVALID_PASSWORD:
         case Password::INVALID_TOKEN:
         case Password::INVALID_USER:
             return Redirect::back()->with('error', Lang::get($response));
         case Password::PASSWORD_RESET:
             return Redirect::to('/');
     }
 }
开发者ID:eiswe,项目名称:website,代码行数:21,代码来源:RemindersController.php

示例15: postReset

 /**
  * Handle a POST request to reset a user's password.
  *
  * @return Response
  */
 public function postReset()
 {
     $credentials = Input::only('email', 'password', 'password_confirmation', 'token');
     $response = Password::reset($credentials, function ($user, $password) {
         $user->password = Hash::make($password);
         $user->save();
     });
     switch ($response) {
         case Password::INVALID_PASSWORD:
         case Password::INVALID_TOKEN:
         case Password::INVALID_USER:
             return Redirect::back()->withErrorMessage(Lang::get($response))->withInput();
         case Password::PASSWORD_RESET:
             return Redirect::to('login')->withFlashMessage('Password has been reset successfully!');
     }
 }
开发者ID:despark,项目名称:laravel-project-starter,代码行数:21,代码来源:RemindersController.php


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