public function postChangePassword() { $validator = Validator::make(Input::all(), array('old_password' => 'required', 'password' => 'required|min:6', 'password_again' => 'required|same:password')); if ($validator->fails()) { return Redirect::route('account-change-password')->withErrors($validator); } else { $user = User::find(Auth::user()->id); $old_password = Input::get('old_password'); $password = Input::get('password'); if (Hash::check($old_password, $user->getAuthPassword())) { $user->password = Hash::make($password); if ($user->save()) { Logging::change_password_success(); return Redirect::route('home')->with('global', 'Your password has been changed.'); } else { Logging::change_password_fail(); } } else { Logging::change_password_fail(); return Redirect::route('account-change-password')->with('global', 'Your old password is incorrect.'); } } return Redirect::route('account-change-password')->with('global', 'Your password could not be changed.'); }