本文整理汇总了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();
});
}
示例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);
}
示例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');
}
}
}
示例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)]);
}
}
示例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.');
}
示例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.");
});
}
示例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');
}
}
示例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('/');
}
}
示例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'));
}
}
示例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!'));
}
}
示例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");
}
}
示例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);
}
}
示例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>');
}
}
示例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('/');
}
}
示例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!');
}
}