/**
  * Handles password change
  *
  * @param ChangePasswordRequest $request
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function putChangePassword(ChangePasswordRequest $request)
 {
     // Put session active tab
     Session::put('profile_tab', 'password');
     if (Hash::check($request->input('old_password'), Auth::user()->password)) {
         Auth::user()->password = Hash::make($request->input('new_password'));
         Auth::user()->save();
         flash()->success(trans('users.password_changed'));
         return redirect()->back();
     } else {
         flash()->error(trans('users.old_password_wrong'));
         return redirect()->back();
     }
 }
Exemplo n.º 2
0
 /**
  * @param ChangePasswordRequest $request
  * @return mixed
  */
 public function changePassword(ChangePasswordRequest $request)
 {
     $this->user->changePassword($request->all());
     return redirect()->route('user.profile')->withFlashSuccess(trans('strings.user.password_updated'));
 }
Exemplo n.º 3
0
 public function changePassword(ChangePasswordRequest $request)
 {
     $user = $this->dispatch(new ChangePassword(app('user'), $request->only(['old_password', 'password'])));
     return $this->setStatus(200)->setMessage('success')->respond($user);
 }